Skip to content

Autodelete a warning mesage, added WoC to invite whitelist, fixed a potential error #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cogs/listeners.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def check_cat_message(self, message: discord.Message):
"""
Checks if a message has 'cat' or 'placeholder' in it and reacts with '<a:placeholder:1277351370751737998>'
"""
if 'cat' in message.content or 'placeholder' in message.content:
if 'cat' in message.content.lower().split() or 'placeholder' in message.content.lower().split():
await message.add_reaction('<a:placeholder:1277351370751737998>')

@commands.Cog.listener("on_message")
Expand Down Expand Up @@ -270,7 +270,7 @@ async def invite_in_message_edit(self, _: discord.Message, after: discord.Messag
if re.search(invite_regex, after.content):
await after.delete()
return await after.channel.send(
"Please don't send invite links in this server!"
"Please don't send invite links in this server!", delete_after=5
)

@commands.Cog.listener("on_message")
Expand All @@ -293,7 +293,7 @@ async def invite_in_message(self, message: discord.Message):
# why are we checking again?
await message.delete()
return await message.channel.send(
"Please don't send invite links in this server!"
"Please don't send invite links in this server!", delete_after=5
)

@commands.Cog.listener("on_message")
Expand Down
3 changes: 2 additions & 1 deletion cogs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ async def send_cat_pic(self):
url = cat_pic
)

await channel.send(embed = embed)
if channel:
await channel.send(embed = embed)

@send_cat_pic.before_loop
async def log_cat_pic_loop(self):
Expand Down
3 changes: 2 additions & 1 deletion ext/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ async def check_invite(bot, content, channel):
267624335836053506, # Python
412754940885467146, # Blurple
613425648685547541, # Discord Developers
661257119588417627, # World of Coding
]
pattern = r"discord(?:(?:(?:app)?\.com)\/invite|\.gg)/([a-zA-z0-9\-]{2,})\b"
matches = re.findall(pattern, content, re.MULTILINE)
Expand Down Expand Up @@ -779,4 +780,4 @@ def invert_string(text):


def gemini_split_string(string, chunk_size=1000):
return [string[i:i+chunk_size] for i in range(0, len(string), chunk_size)]
return [string[i:i+chunk_size] for i in range(0, len(string), chunk_size)]