我在一个discord服务器中有一个bot,当他们键入一个名为hello的命令时,bot将从列表中的随机选择中做出响应。在
我试图让机器人以不同的方式响应,如果它是一个非常特定的用户id
这不管用
@bibi.command()
async def hello():
if message.author.id == ('279460450637185024'):
choicesa = ('get away', 'dont greet me', 'youre wasting my time', 'Hallo', 'oh god its you', '....' , 'dude go away' , 'WHAT DO YOU WANT' , 'HIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII' , 'i dont talk to democrats')
await bibi.say(random.choice(choicesa))
elif message.author.id == ('80971950054187008'):
choicesl = ('lauren...', 'hi. lauren.')
await bibi.say(random.choice(choicesl))
意思是消息没有被定义,现在我明白了,我以为它是在discords库中定义的,但它没有。在
我该怎么做?在
只需尝试在函数中添加ctx作为参数,然后将其添加为启动器。在
如果使用的是重写版本的d.py,则必须通过执行
async def hello(ctx):
将ctx
参数传递给hello。那么在重写中你不能使用bot.say
(或bibi.say
)。您必须使用ctx.send(message)
而不是bibi.say(message)
。在我知道它会搞乱你所有的其他命令,但如果你像我下面那样做,它会起作用的。在
相关问题 更多 >
编程相关推荐