Skip to content

Commit

Permalink
Update license name
Browse files Browse the repository at this point in the history
  • Loading branch information
hypergonial committed Aug 30, 2023
1 parent df77abc commit a7525eb
Show file tree
Hide file tree
Showing 54 changed files with 84 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github: HyperGH
github: hypergonial
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ updates:
schedule:
interval: daily
assignees:
- HyperGH
- hypergonial
reviewers:
- HyperGH
- hypergonial
rebase-strategy: auto
target-branch: main
2 changes: 1 addition & 1 deletion config_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Config:
DEBUG_GUILDS: t.Sequence[int] = (123, 456, 789) # Commands will only be registered here if DEV_MODE is on


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion db/schema.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-- Copyright (C) 2022-present HyperGH
-- Copyright (C) 2022-present hypergonial

-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion etc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .perms_str import *
from .settings_static import *

# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion etc/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
EMOJI_NEXT = "<:next:956672907185123359>"
EMOJI_LAST = "<:last:956672908082708480>"

# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion etc/perms_str.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_perm_str(perm: hikari.Permissions) -> str:
return perm.name.replace("_", " ").title()


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion etc/settings_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@
"warn": "Warnings",
}

# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/annoverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(annoverse)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
57 changes: 27 additions & 30 deletions extensions/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
from utils import helpers
from utils.ratelimiter import BucketType

INVITE_REGEX = re.compile(r"(?:https?://)?discord(?:app)?\.(?:com/invite|gg)/[a-zA-Z0-9]+/?")
URL_REGEX = re.compile(r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")

logger = logging.getLogger(__name__)

automod = SnedPlugin("Auto-Moderation", include_datastore=True)
Expand Down Expand Up @@ -271,6 +274,7 @@ async def punish(
return


# TODO: Seperate detections into seperate functions
@automod.listener(hikari.GuildMessageCreateEvent, bind=True)
@automod.listener(hikari.GuildMessageUpdateEvent, bind=True)
async def scan_messages(
Expand Down Expand Up @@ -340,9 +344,7 @@ async def scan_messages(
)

if policies["invites"]["state"] != AutoModState.DISABLED.value:
invite_regex = re.compile(r"(?:https?://)?discord(?:app)?\.(?:com/invite|gg)/[a-zA-Z0-9]+/?")

if invite_regex.findall(message.content):
if INVITE_REGEX.findall(message.content):
return await punish(
message,
policies,
Expand All @@ -352,8 +354,7 @@ async def scan_messages(

if isinstance(event, hikari.GuildMessageCreateEvent):
if policies["link_spam"]["state"] != AutoModState.DISABLED.value:
link_regex = re.compile(r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+")
link_matches = link_regex.findall(message.content)
link_matches = URL_REGEX.findall(message.content)
if len(link_matches) > 7:
return await punish(
message,
Expand All @@ -362,18 +363,16 @@ async def scan_messages(
reason="having too many links in a single message",
)

if not link_matches:
return
if link_matches:
await link_spam_ratelimiter.acquire(message)

await link_spam_ratelimiter.acquire(message)

if link_spam_ratelimiter.is_rate_limited(message):
return await punish(
message,
policies,
AutomodActionType.LINK_SPAM,
reason="posting links too quickly",
)
if link_spam_ratelimiter.is_rate_limited(message):
return await punish(
message,
policies,
AutomodActionType.LINK_SPAM,
reason="posting links too quickly",
)

if policies["caps"]["state"] != AutoModState.DISABLED.value and len(message.content) > 15:
chars = [char for char in message.content if char.isalnum()]
Expand All @@ -395,22 +394,20 @@ async def scan_messages(
kosu.Attribute(kosu.AttributeName.THREAT),
]
try:
logger.info(f"Perspective is analyzing message:\n{message.content}")
resp: kosu.AnalysisResponse = await plugin.app.perspective.analyze(message.content, persp_attribs)
except kosu.PerspectiveException as e:
logger.info(f"Perspective failed to analyze a message: {str(e)}")
return
scores = {score.name.name: score.summary.value for score in resp.attribute_scores}
logger.debug(f"Perspective failed to analyze a message: {str(e)}")
else:
scores = {score.name.name: score.summary.value for score in resp.attribute_scores}

for score, value in scores.items():
if value > policies["perspective"]["persp_bounds"][score]:
logger.info(f"Perspective detected toxic content with certainty {value} of kind {score}")
return await punish(
message,
policies,
AutomodActionType.PERSPECTIVE,
reason=f"toxic content detected by Perspective ({score.replace('_', ' ').lower()}: {round(value*100)}%)",
)
for score, value in scores.items():
if value > policies["perspective"]["persp_bounds"][score]:
return await punish(
message,
policies,
AutomodActionType.PERSPECTIVE,
reason=f"toxic content detected by Perspective ({score.replace('_', ' ').lower()}: {round(value*100)}%)",
)


def load(bot: SnedBot) -> None:
Expand All @@ -421,7 +418,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(automod)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/command_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(ch)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ async def resetsettings_cmd(ctx: SnedPrefixContext, guild_id: int) -> None:
await ctx.respond(f"✅ Wiped data for guild `{guild.id}`.")


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/fallingfrontier.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(ff)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/fandom.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(fandom)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(fun)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(help)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
8 changes: 4 additions & 4 deletions extensions/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ async def about(ctx: SnedSlashContext) -> None:
**• Online since:** {helpers.format_dt(ctx.app.start_time, style='R')}
**• Invite:** [Invite me!](https://discord.com/oauth2/authorize?client_id={me.id}&permissions=1494984682710&scope=bot%20applications.commands)
**• Support:** [Click here!](https://discord.gg/KNKr8FPmJa)
**• Terms of Service:** [Click here!](https://github.com/HyperGH/snedbot_v2/blob/main/tos.md)
**• Privacy Policy:** [Click here!](https://github.com/HyperGH/snedbot_v2/blob/main/privacy.md)\n
**• Terms of Service:** [Click here!](https://github.com/hypergonial/snedbot_v2/blob/main/tos.md)
**• Privacy Policy:** [Click here!](https://github.com/hypergonial/snedbot_v2/blob/main/privacy.md)\n
Blob emoji is licensed under [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)""",
color=const.EMBED_BLUE,
)
Expand Down Expand Up @@ -269,7 +269,7 @@ async def support(ctx: SnedSlashContext) -> None:
@lightbulb.command("source", "Provides a link to the source-code of the bot.")
@lightbulb.implements(lightbulb.SlashCommand)
async def source(ctx: SnedSlashContext) -> None:
await ctx.respond("<https://github.com/HyperGH/snedbot>")
await ctx.respond("<https://github.com/hypergonial/snedbot>")


@misc.command
Expand Down Expand Up @@ -524,7 +524,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(misc)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(mod)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(reminders)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(reports)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/role_buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(role_buttons)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(settings)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/starboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(starboard)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(tags)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def unload(bot: SnedBot) -> None:
pass


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/troubleshooter.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(troubleshooter)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion extensions/userlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ def unload(bot: SnedBot) -> None:
bot.remove_plugin(userlog)


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
if __name__ == "__main__":
bot.run()

# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .timer import *
from .views import *

# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion models/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ async def backup_db(self) -> None:
logging.info("Database backup complete.")


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion models/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def bot_has_permissions(perm1: hikari.Permissions, *perms: hikari.Permissions) -
return lightbulb.Check(functools.partial(_bot_has_permissions, perms=reduced))


# Copyright (C) 2022-present HyperGH
# Copyright (C) 2022-present hypergonial

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
Loading

0 comments on commit a7525eb

Please sign in to comment.