Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Channel.fetch_消息(id)未返回所需结果_Python_Python 3.x_Discord_Discord.py_Discord.py Rewrite - Fatal编程技术网

Python Channel.fetch_消息(id)未返回所需结果

Python Channel.fetch_消息(id)未返回所需结果,python,python-3.x,discord,discord.py,discord.py-rewrite,Python,Python 3.x,Discord,Discord.py,Discord.py Rewrite,我希望通过id获取特定消息的实例,并希望使用channel.fetch\u Message(id),但这将返回一个没有诸如add\u reaction()之类函数的协同路由。我做错了什么 方法如下: @commands.command() async def reaction_on_message(self, ctx, channel: discord.TextChannel, message_id, emoji): message = channel.get_message(messa

我希望通过id获取特定消息的实例,并希望使用channel.fetch\u Message(id),但这将返回一个没有诸如add\u reaction()之类函数的协同路由。我做错了什么

方法如下:

@commands.command()
async def reaction_on_message(self, ctx, channel: discord.TextChannel, message_id, emoji):
    message = channel.get_message(message_id)
    print(type(message))
    message.add_reaction(emoji)
    user = await self.bot.get_user_info(ctx.message.author.id)
    await user.send("Hello This Works!")

你必须在它之前使用wait。你可以在这里看到

wait channel.fetch_消息(此处为ID_)
等待消息。添加反应(表情符号)

OMG哦,我忘了xD Thank解决了问题,这真令人尴尬:)不用担心会发生这种情况,请您将其标记为已解决。