fix(bot): 🐛 Allow some words on call and allow @Payphone as command prefix.

This commit is contained in:
Nyeki.py
2024-10-23 13:11:03 -03:00
parent b3de935f9a
commit 652a17a85a
2 changed files with 19 additions and 7 deletions
+11 -2
View File
@@ -255,6 +255,8 @@ class Payphone(commands.AutoShardedBot):
ValueError: Either `message` or `server_id` must be set, but not both. ValueError: Either `message` or `server_id` must be set, but not both.
""" """
default_prefixes = ["p.", "P.", self.user.mention]
if message is not None and server_id is not None: if message is not None and server_id is not None:
raise ValueError( raise ValueError(
"Either `message` or `server_id` must be set, but not both." "Either `message` or `server_id` must be set, but not both."
@@ -264,10 +266,17 @@ class Payphone(commands.AutoShardedBot):
raise ValueError("Either `message` or `server_id` must be set.") raise ValueError("Either `message` or `server_id` must be set.")
if message is not None and message.guild is None: if message is not None and message.guild is None:
return ["p.", "P."] return default_prefixes
if message is not None and message.content is None: if message is not None and message.content is None:
return "p." return default_prefixes
if (
message is not None
and message.content is not None
and message.content.startswith(self.user.mention)
):
return default_prefixes
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
+8 -5
View File
@@ -187,8 +187,8 @@ BLOCKED_WORDS = [
"footjob", "footjob",
"frotting", "frotting",
"fuck buttons", "fuck buttons",
"fuckin", # "fuckin",
"fucking", # "fucking",
"fucktards", "fucktards",
"fudge packer", "fudge packer",
"fudgepacker", "fudgepacker",
@@ -510,15 +510,18 @@ BLOCKED_WORDS = [
"skeletor", "skeletor",
"chunk", "chunk",
"blubber", "blubber",
"skinny", # "skinny",
"nigga", "nigga",
"nigger", "nigger",
"nga" "nga",
] ]
] ]
WORDS = re.compile(r"\w+") WORDS = re.compile(r"\w+")
PATTERN = re.compile(f"^({"|".join(BLOCKED_WORDS)})$", re.IGNORECASE) PATTERN = re.compile(
f"^({"|".join(BLOCKED_WORDS + [word + "s" for word in BLOCKED_WORDS])})$",
re.IGNORECASE,
)
URL_PATTERN = re.compile(r"https?://[^\s]+", re.IGNORECASE) URL_PATTERN = re.compile(r"https?://[^\s]+", re.IGNORECASE)
INVITES_PATTERN = re.compile(r"discord.gg/[^\s]+", re.IGNORECASE) INVITES_PATTERN = re.compile(r"discord.gg/[^\s]+", re.IGNORECASE)