Skip to content
This repository was archived by the owner on Aug 28, 2025. It is now read-only.

Added AFK and Slowmode commands#5

Open
BruceCodesGithub wants to merge 1 commit into
Pycord-Development:mainfrom
BruceCodesGithub:patch-4
Open

Added AFK and Slowmode commands#5
BruceCodesGithub wants to merge 1 commit into
Pycord-Development:mainfrom
BruceCodesGithub:patch-4

Conversation

@BruceCodesGithub

Copy link
Copy Markdown

AFK is completly ping-proof

AFK is completly ping-proof

@BobDotCom BobDotCom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many changes needed. Recommended to remove all except afk commands, and fix afk commands.

Comment thread main.py

@bot.event
async def on_message(message):
if bot.afk_users.get(message.author.id):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation errors here

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, do you use spaces for indentation?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, as per https://www.python.org/dev/peps/pep-0008/#code-lay-out.
Regardless, there are inconsistencies whether or not spaces or tabs are used.

Comment thread main.py
async def on_message(message):
if bot.afk_users.get(message.author.id):
del bot.afk_users[message.author.id]
return await message.channel.send(f'Welcome back {message.author.name}, you are no longer AFK')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should include a delete_after

Comment thread main.py
await ctx.respond(f"Here's a link", view=view)



Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why

Comment thread main.py
del bot.afk_users[message.author.id]
return await message.channel.send(f'Welcome back {message.author.name}, you are no longer AFK')

for mention in message.mentions:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more we can do with this. It would be nice to have it say "person1 and person2 are afk" instead of just sending one person's message.

Comment thread main.py

for mention in message.mentions:
if bot.afk_users.get(mention.id):
return await message.channel.send(f'{mention.name} is AFK: {bot.afk_users[mention.id]}', allowed_mentions = discord.AllowedMentions.none())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more indentation errors

Comment thread main.py
else:
await ctx.respond("You do not have the `Manage Message` permission which is required to run this command.", ephemeral=True)

for i in ["jishaku", "cogs.rtfm", "cogs.modmail", "cogs.tags"]:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here

Comment thread main.py
bot.afk_users[ctx.author.id] = reason
await ctx.send(f'{ctx.author.name}, I set your AFK with the reason: {reason}', allowed_mentions=discord.AllowedMentions.none(), ephemeral=True)

@afk.command(name='remove')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a remove command, someone can just send a message to remove it. The set command can be moved out of the command group.

Comment thread main.py
@afk.command(name='set')
async def afk_set(ctx, *, reason = 'No reason provided'):
if bot.afk_users.get(ctx.author.id):
return await ctx.send(f'{ctx.author.name}, you\'re already AFK')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send() is incorrect here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use double quotes here

Comment thread main.py
if bot.afk_users.get(ctx.author.id):
return await ctx.send(f'{ctx.author.name}, you\'re already AFK')
if len(reason) > 100: # so that chat doesn't flood when the reason has to be shown
return await ctx.send(f'{ctx.author.name}, keep your AFK reason under 100 characters')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send() is incorrect here

Comment thread main.py
if len(reason) > 100: # so that chat doesn't flood when the reason has to be shown
return await ctx.send(f'{ctx.author.name}, keep your AFK reason under 100 characters')
bot.afk_users[ctx.author.id] = reason
await ctx.send(f'{ctx.author.name}, I set your AFK with the reason: {reason}', allowed_mentions=discord.AllowedMentions.none(), ephemeral=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

send() is incorrect here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allowed_mentions is redundant.

@pullapprove4

pullapprove4 Bot commented Jul 27, 2023

Copy link
Copy Markdown

Please add a changelog entry

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants