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
10 changes: 9 additions & 1 deletion src/bot/cogs/logging/logging_message_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def __init__(self, bot):
self.staff_channel = self.bot.api.get_one_setting("3")[0]["setting"][
2
] # Staff Channel ID
self.verification_channel = self.bot.api.get_one_setting("1")[0]["setting"][2]
self.verification_command = f"{os.getenv('PREFIX')}verify"
self.chat_log = self.bot.api.get_one_log_setting("3") # chat_log

@commands.Cog.listener()
Expand All @@ -65,10 +67,16 @@ async def on_message_delete(self, message):
)
return

if message.channel.id == self.staff_channel:
if message.channel.id == int(self.staff_channel):
logger.debug("Message delete in staff channel was ignored.")
return

if message.channel.id == int(self.verification_channel) and (
message.author.bot or message.content == self.verification_command
):
logger.debug("Message from verification process was ignored.")
return

audit_log = [entry async for entry in message.guild.audit_logs(limit=1)][0]
if self.chat_log[0]["status"] == "ok":
if self.chat_log[0]["logging"][2] == "0":
Expand Down
14 changes: 9 additions & 5 deletions src/bot/cogs/verification/verification_dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ async def callback(self, interaction: discord.Interaction):
"Someone is verifying, but there is no verification role set!"
)
else:
msg = await interaction.response.send_message("You are a robot? Nice try.")
response = await interaction.response.send_message(
"You are a robot? Nice try."
)
await verification_log.send(
f"{interaction.user.display_name} admitted to being a robot, and was kicked. "
f"{interaction.user.display_name} admitted to being a robot, and was kicked."
)
sleep(3)
await response.resource.delete()
await interaction.user.kick(reason="User admitted to being a robot.")
await msg.delete()


class DropdownView(discord.ui.View):
Expand Down Expand Up @@ -131,7 +133,7 @@ async def verify(self, ctx):
return

else:
if self.verified_role not in [role.id for role in ctx.author.roles]:
if int(self.verified_role) not in [role.id for role in ctx.author.roles]:
logger.debug(f"{ctx.author.name} is attempting to verify")
await ctx.send(
"# ~ Verification ~ \n"
Expand All @@ -141,7 +143,9 @@ async def verify(self, ctx):
delete_after=15.0,
)
else:
await ctx.send("You are already verified. Go away.")
msg = await ctx.send("You are already verified. Go away.")
sleep(10)
await msg.delete()


async def setup(bot: commands.Bot) -> None:
Expand Down
65 changes: 37 additions & 28 deletions src/bot/cogs/verification/verification_on_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,34 +81,43 @@ async def on_member_join(self, member: discord.Member):
# Is being called even though it should not be.
# await self.kick_if_not_verified(member, 3600, verification_log)

# @commands.Cog.listener()
# async def on_message(self, message):
# """
# Keep verification clean again
# """
# if message.author.guild.id != int(os.getenv("MASTER_GUILD")):
# logger.warning("on_message in verification fired, but not in master guild. Ignoring event.")
# return
#
# if message.channel.id == int(self.verification_channel):
# if not message.author.bot:
# if f"{os.getenv('PREFIX')}verify" == message.content: # keep it exact
# # user is doing it right, and the verification_dropdown is triggered
# logger.debug(f"{message.author.name} started verification.")
# await sleep(3)
# await message.delete() # cleanup correct verification calls
# return
# else: # this covers any other message in the channel.
# await message.delete() # delete the user's incorrect message
# bot_message = await message.channel.send(
# f"You need to use the **{os.getenv('PREFIX')}verify** command.")
#
# logs_channel = await self.bot.fetch_channel(self.verification_log)
# await logs_channel.send(
# f"{message.author} is failing at life in {self.bot.get_channel(self.verification_channel)}")
#
# await sleep(8)
# bot_message.delete() # remove the message to correct people after 8? seconds
@commands.Cog.listener()
async def on_message(self, message):
"""
Keep verification clean again
"""
if message.author.guild.id != int(os.getenv("MASTER_GUILD")):
logger.warning(
"on_message in verification fired, but not in master guild. Ignoring event."
)
return

if message.channel.id == int(self.verification_channel):
if not message.author.bot and not (
message.author.guild_permissions.administrator
or message.author.guild_permissions.ban_members
):
if f"{os.getenv('PREFIX')}verify" == message.content: # keep it exact
# user is doing it right, and the verification_dropdown is triggered
logger.debug(f"{message.author.name} started verification.")
await sleep(3)
await message.delete() # cleanup correct verification calls
return
else: # this covers any other message in the channel.
await message.delete() # delete the user's incorrect message
bot_message = await message.channel.send(
f"You need to use the **{os.getenv('PREFIX')}verify** command."
)

logs_channel = await self.bot.fetch_channel(self.verification_log)
await logs_channel.send(
f"{message.author} is failing at life in {self.bot.get_channel(int(self.verification_channel)).mention}"
)

await sleep(8)
await (
bot_message.delete()
) # remove the message to correct people after 8? seconds


async def setup(bot: commands.Bot) -> None:
Expand Down
Loading