【发布时间】:2021-04-11 21:37:04
【问题描述】:
我希望当有人执行 /AFK 并写字母而不是数字时,它应该显示类似“输入数字而不是字母”的内容。这是我的代码:
async def afk(ctx, mins : int):
current_nick = ctx.author.nick
await ctx.send(f"{ctx.author.mention} has gone afk for {mins} minutes.", delete_after=5)
await ctx.author.edit(nick=f"[AFK]{ctx.author.name}")
counter = 0
while counter <= int(mins):
counter += 1
await asyncio.sleep(60)
if counter == int(mins):
await ctx.author.edit(nick=current_nick)
await ctx.send(f"{ctx.author.mention} is no longer AFK", delete_after=5)
break```
【问题讨论】:
标签: python command discord discord.py