为什么discord.py不允许我添加反应?

时间:2020-01-17 13:29:21

标签: python discord discord.py discord.py-rewrite

所以这是我目前拥有的东西,除了它不起作用。它给了我以下错误:

Ignoring exception in command suggestion:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\site- 
packages\discord\ext\commands\core.py", line 79, in wrapped
ret = await coro(*args, **kwargs)
File "c:/Users/user/OneDrive/Documents/Discord bot/main.py", line 57, in suggestion   
await bot.add_reaction(message, ":yes:614465426788843551")
AttributeError: 'Bot' object has no attribute 'add_reaction'

,然后我又遇到了同样的错误,只是:no:。你们可以帮忙吗?

代码:

@bot.command(pass_context=True)
async def suggestion(message):
    await bot.add_reaction(message, ":yes:614465426788843551")
    await bot.add_reaction(message, ":no:614465426381996033")
    print('test done')

1 个答案:

答案 0 :(得分:0)

您正在使用discord.py版本v0.16中的语法,该语法不再受支持。
请参见the guide for migrating to v1,尤其是Models are Stateful section
您应该使用Message.add_reaction而不是img.addEventListener('change', function () { var input = this; console.log(input); });