Skip to content
Open
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
5 changes: 4 additions & 1 deletion src/bot/cogs/admin/points.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ async def on_message(self, message) -> None:
"""
if message.author.bot:
return
if message.guild.id != int(os.getenv("MASTER_GUILD")):
if message.guild is None or message.guild.id != int(os.getenv("MASTER_GUILD")):
return

msg = message.content.split()
Expand All @@ -219,6 +219,9 @@ async def on_message_delete(self, message):
"""
if message.author.bot:
return
if message.guild is None or message.guild.id != int(os.getenv("MASTER_GUILD")):
return

msg = message.content.split()
logger.debug(
f"Updating -{len(msg)} points for {message.author.display_name} for deleting a message."
Expand Down
20 changes: 10 additions & 10 deletions src/bot/cogs/moderation/admin_automod_spam_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ async def on_message(self, message):

author_id = message.author.id
content = message.content or ""
if message.attachments:
attachment = message.attachments[0]
attachment = message.attachments[0] if message.attachments else None
if attachment:
content += hashlib.sha256(
f"|{attachment.filename}|{attachment.size}|{attachment.content_type}".encode()
).hexdigest()
Expand Down Expand Up @@ -142,11 +142,11 @@ async def on_message(self, message):
{
"message_id": message.id,
"channel_id": message.channel.id,
"file_name": message.attachments[0].filename
if not message.content
"file_name": attachment.filename
if attachment and not message.content
else None,
"file_url": message.attachments[0].url
if not message.content
"file_url": attachment.url
if attachment and not message.content
else None,
}
)
Expand All @@ -163,11 +163,11 @@ async def on_message(self, message):
{
"message_id": message.id,
"channel_id": message.channel.id,
"file_name": message.attachments[0].filename
if not message.content
"file_name": attachment.filename
if attachment and not message.content
else None,
"file_url": message.attachments[0].url
if not message.content
"file_url": attachment.url
if attachment and not message.content
else None,
}
],
Expand Down
1 change: 0 additions & 1 deletion src/bot/cogs/moderation/admin_mute.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ async def mute_member(
"""

if not target.bot:
logger.info("0")
if not target.guild_permissions.administrator:
# Message the user, informing them of their fate
await interaction.response.defer()
Expand Down
8 changes: 5 additions & 3 deletions src/bot/cogs/verification/verification_dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ def __init__(self, bot):
async def verify(self, ctx):
"""Command to verify yourself."""

if str(type(ctx.channel)) == "<class 'discord.channel.DMChannel'>":
await ctx.respond(
f"You need to use the command in the {self.bot.get_channel(self.verification_channel).mention} channel."
if isinstance(ctx.channel, discord.DMChannel):
verification_channel = self.bot.get_channel(int(self.verification_channel))
await ctx.send(
f"You need to use the command in the "
f"{verification_channel.mention if verification_channel else 'verification'} channel."
)
return

Expand Down
3 changes: 2 additions & 1 deletion src/bot/cogs/verification/verification_on_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ async def log_unverified_join(self, member, logging_channel):
await logging_channel.send(f"<@{member.id}> joined, but has not verified.")

async def send_welcome_message(self, guild, member):
verification_channel = self.bot.get_channel(int(self.verification_channel))
welcome_message = f"""
Hi there, {member.mention}
I'm Zorak, the moderator of {guild.name}.

We are very happy that you have decided to join us.
Before you are allowed to chat, you need to verify that you are NOT a bot.\n
Dont worry... it's easy.
Just go to {self.bot.get_channel(self.verification_log) if self.verification_log is not None else "the verification channel"}
Just go to {verification_channel.mention if verification_channel else "the verification channel"}
and use the **{os.getenv("PREFIX")}verify** command.

After you do, all of {guild.name} is available to you. Have a great time :-)
Expand Down
Loading