所以,我不能使用"?命令和"?"烤@(用户);同时……
@client.event
async def on_ready():
await client.change_presence(status=discord.Status.dnd, activity=discord.Game(' "?" Booe'))
print('Bot is ready to play!')
@client.command()
async def roast(ctx, member:discord.Member):
roast_messages = [
f'{ctx.message.author.mention}You are useless as the UEUE in Queue {member.mention}',
]
await ctx.send(random.choice(roast_messages))
总是有办法解决的,discord给了我们这样的办法
@client.command()
async def roast(ctx, member:discord.Member=None):#None is if nothing is given then its None
if member == None:
member = ctx.author
roast_messages = [
f'{ctx.message.author.mention}You are useless as the UEUE in Queue {member.mention}',]
await ctx.send("imagine roasting yourself")#Your Choice Absolutely :)
await ctx.send(random.choice(roast_messages))
在中,如果没有指定成员,则调用该函数时将成员值设为none,然后将none值赋给ctx。作者本身(不要试图写ctx)。在async def roast
中,它给出错误,而不是none,因为ctx没有定义。另外,我忘了你的留言是没有意义的,所以一定要把它们也编辑了:)