fix(bot): 🐛 Fix censorship.
This commit is contained in:
+7
-1
@@ -243,6 +243,9 @@ class Payphone(commands.AutoShardedBot):
|
|||||||
if message is not None and message.guild is None:
|
if message is not None and message.guild is None:
|
||||||
return ["p.", "P."]
|
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
|
server_id = server_id if server_id is not None else message.guild.id
|
||||||
|
|
||||||
key = constants.PREFIX_TEMPLATE % server_id
|
key = constants.PREFIX_TEMPLATE % server_id
|
||||||
@@ -259,7 +262,7 @@ class Payphone(commands.AutoShardedBot):
|
|||||||
|
|
||||||
prefix = server.prefix
|
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 message.content[: len(prefix)]
|
||||||
|
|
||||||
return prefix
|
return prefix
|
||||||
@@ -375,6 +378,9 @@ async def is_channel_enabled(ctx: commands.Context) -> Literal[True]:
|
|||||||
|
|
||||||
if ctx.guild is None:
|
if ctx.guild is None:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
if ctx.command.qualified_name in ["config enable", "config disable"]:
|
||||||
|
return True
|
||||||
|
|
||||||
server_id = ctx.guild.id
|
server_id = ctx.guild.id
|
||||||
channel_id = ctx.channel.id
|
channel_id = ctx.channel.id
|
||||||
|
|||||||
@@ -243,19 +243,19 @@ def moderate(message: str) -> str:
|
|||||||
str | None: The blocked pattern found as it was found.
|
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:
|
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:
|
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:
|
if match is not None:
|
||||||
return message[match.start]
|
return message[match.start():match.end()]
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user