擅长:python、mysql、java
<p>如果您的邮件<strong>仅<strong>包含要获取的邮件的<code>id</code>,请通过</p>
<pre><code>messageid = int(ctx.content)
</code></pre>
<p>之后,您可以使用<a href="https://discordpy.readthedocs.io/en/stable/api.html#discord.TextChannel.fetch_message" rel="nofollow noreferrer">^{<cd2>}</a>获取消息。然而,这只有在您知道您想要获取的消息位于哪个通道时才起作用。如果消息在<code>channelsnipe</code>中,则通过</p>
<pre><code>message = await channelsnipe.fetch_message(messageid)
</code></pre>
<p>得到第一反应</p>
<pre><code>reaction = message.reactions[0]
</code></pre>
<hr/>
<p>bot=discord.Client()</p>
<pre><code>@bot.event
async def on_message(ctx):
idbot = 835947059721797702
if ctx.author.id == idbot:
channelsnipe = bot.get_channel(825523364844142601)
messageid = int(ctx.content)
message = await channelsnipe.fetch_message(messageid)
await asyncio.sleep(0.2) # Give time for reaction to update on cache
reaction = message.reactions[0] # Get first reaction of a message
emoji = reaction.emoji
await message.add_reaction(emoji)
</code></pre>