在我的on_message下,我有这个;
if message.channel.id == 809991898722861137:
emoji = client.get_emoji(830070201885130823)
await message.add_reaction(emoji)
emoji = client.get_emoji(830070201722601523)
await message.add_reaction(emoji)
emoji = client.get_emoji(830070202091175976)
await message.add_reaction(emoji)
emoji = client.get_emoji(830070201654837249)
await message.add_reaction(emoji)
但是每当我做命令让我的机器人发送信息时,这些反应只会张贴在我的信息上,而不是我的机器人上。
有什么办法我可以做到这一点,所以反应将在我的机器人信息,以及?
发布于 2021-06-12 20:55:39
我猜你希望你的信息和机器人的信息都有反应。
import discord
from discord.ext import commands
import asyncio
client = commands.Bot(command_prefix=".")
@client.event
async def on_message(message):
if message.channel.id == 809991898722861137:
emoji = '\N{THUMBS UP SIGN}' # Thumbs up emoji
await message.add_reaction(emoji)
await client.process_commands(message)
或者,如果你希望反应只出现在机器人上:
import discord
from discord.ext import commands
import asyncio
client = commands.Bot(command_prefix=".")
@client.event
async def on_message(message):
if message.channel.id == 809991898722861137:
if message.author == client.user: # Check if the message came from the bot
emoji = '\N{THUMBS UP SIGN}' # Thumbs up emoji
await message.add_reaction(emoji)
else:
# Do something else
await client.process_commands(message)
https://stackoverflow.com/questions/67952336
复制相似问题