Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7
Chore: Fix the cleanup of Verification channel#176
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
74d3086
Uncommented working code, added missing await and a check for message…
kritarth2135 c4f57c0
Fixed message deletion and comparison of string id with int ids
kritarth2135 d81faf0
Skip logging deleted messages from verification process
kritarth2135 386748c
Fixed a typo and a bit of formatting
kritarth2135 06a2f35
Ruff pre-commit changes
kritarth2135 7a0094f
Fixed removal a necessary space thinking it was unnecessary
kritarth2135 7533539
Replaced manual deletion of messages from bot with delete_after argument
kritarth2135 ee6a61c
Skipping messages sent in DM for verification
kritarth2135 1efcb8d
Ruff formatting
kritarth2135 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -89,34 +89,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): | ||
kritarth2135 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| """ | ||
| Keep verification clean again | ||
| """ | ||
| if isinstance(message.channel, discord.channel.DMChannel): | ||
| logger.info("Skipping messages in DMs.") | ||
| return | ||
| 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 | ||
| await message.channel.send( | ||
| f"You need to use the **{os.getenv('PREFIX')}verify** command.", | ||
| delete_after=8.0, | ||
| ) | ||
| 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}" | ||
| ) | ||
| async def setup(bot: commands.Bot) -> None: | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.