From f1af800e10b917869edb5ac0586fb58fb25642e7 Mon Sep 17 00:00:00 2001 From: RGBCube Date: Sat, 17 Dec 2022 15:13:57 +0300 Subject: [PATCH] Fix errors --- minearchy_bot/cogs/misc.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/minearchy_bot/cogs/misc.py b/minearchy_bot/cogs/misc.py index 8b60b6a..c5ff455 100644 --- a/minearchy_bot/cogs/misc.py +++ b/minearchy_bot/cogs/misc.py @@ -73,20 +73,25 @@ class Miscellaneous( return await message.author.edit(nick=name[5:]) - await message.channel.send( - f"Welcome back {escape_markdown(message.author.mention)}! I've unset your AFK status.") + await message.channel.send(f"Welcome back {escape_markdown(message.author.mention)}! I've unset your AFK status.") @command( brief="Sets you as AFK.", help="Sets you as AFK.", ) async def afk(self, ctx: Context) -> None: - if ctx.me.top_role.position <= ctx.author.top_role.position: - await ctx.reply( - "I cannot set you as AFK because my role is lower than yours. You can edit your nickname to set yourself as AFK (Add [AFK] to the start of it.).") + # no error cuz it will un-afk them + if ctx.author.display_name.lower().startswith("[AFK]"): return - await ctx.author.edit(nick=f"[AFK] {ctx.author.display_name}") + if ctx.me.top_role.position <= ctx.author.top_role.position: + await ctx.reply( + "I cannot set you as AFK because my role is lower than yours." + "You can edit your nickname to set yourself as AFK (Add [AFK] to the start of it.)." + ) + return + + await ctx.author.edit(nick=f"[AFK] {ctx.author.display_name}"[:32]) await ctx.reply("Set your status to AFK. You can now touch grass freely 🌲.") @Cog.listener()