【发布时间】:2020-10-02 23:41:05
【问题描述】:
我制作了一个有效的 AFK 代码,但如果用户发送消息,我需要它来分割(删除)“[AFK]”。代码是:
@client.command()
async def afk(ctx, *, message="Dind't specify a message."):
global afk_dict
if ctx.author in afk_dict:
afkdict.pop(ctx.author)
await ctx.send('Welcome back! You are no longer afk.')
await ctx.author.edit(nick=ctx.author.display_name(slice[-6]))
else:
afk_dict[ctx.author] = message
await ctx.author.edit(nick=f'[AFK] {ctx.author.display_name}')
await ctx.send(f"{ctx.author.mention}, You're now AFK.")
我没有错误。我只需要await ctx.author.edit(nick=ctx.author.display_name(slice[-6])) 就能工作,我会很开心。
【问题讨论】:
标签: python discord discord.py discord.py-rewrite