fix(bot): 🐛 Fix censorship.

This commit is contained in:
Nyeki.py
2024-10-17 16:01:08 -03:00
parent f33a2c0bb9
commit 177f55fb06
2 changed files with 13 additions and 7 deletions
+7 -1
View File
@@ -243,6 +243,9 @@ class Payphone(commands.AutoShardedBot):
if message is not None and message.guild is None:
return ["p.", "P."]
if message is not None and message.content is None:
return "p."
server_id = server_id if server_id is not None else message.guild.id
key = constants.PREFIX_TEMPLATE % server_id
@@ -259,7 +262,7 @@ class Payphone(commands.AutoShardedBot):
prefix = server.prefix
if message.content.lower().startswith(prefix.lower()):
if message is not None and message.content.lower().startswith(prefix.lower()):
return message.content[: len(prefix)]
return prefix
@@ -375,6 +378,9 @@ async def is_channel_enabled(ctx: commands.Context) -> Literal[True]:
if ctx.guild is None:
return True
if ctx.command.qualified_name in ["config enable", "config disable"]:
return True
server_id = ctx.guild.id
channel_id = ctx.channel.id
+6 -6
View File
@@ -243,19 +243,19 @@ def moderate(message: str) -> str:
str | None: The blocked pattern found as it was found.
"""
match = PATTERN.match(message)
match = next(PATTERN.finditer(message), None)
if match is not None:
return match.string
return message[match.start():match.end()]
match = URL_PATTERN.match(message)
match = next(URL_PATTERN.finditer(message), None)
if match is not None:
return match.string
return message[match.start():match.end()]
match = INVITES_PATTERN.match(message)
match = next(INVITES_PATTERN.finditer(message), None)
if match is not None:
return message[match.start]
return message[match.start():match.end()]
return None