【发布时间】:2020-03-28 18:12:43
【问题描述】:
我正在尝试为机器人发出命令,当消息中提到的每个人都对机器人的响应做出反应时,它会提到原始消息作者
我试过了
if msg.content.startswith('/iniciar'):
async with msg.channel.typing():
mentions = ""
for mention in msg.mentions:
mentions = mentions + " " + mention.mention
bot_msg: discord.Message = await msg.channel.send(mentions + ' confirmem presença reagindo abaixo.')
await bot_msg.add_reaction('✅')
for mention in msg.mentions:
def check(reaction, user):
return user == mention and str(reaction.emoji) == '✅'
try:
reaction, user = await client.wait_for('reaction_add', check=check)
finally:
reactionusers: list = await reaction.users().flatten()
reactionusers.remove(reactionusers[0])
print(reactionusers)
print(msg.mentions)
if reactionusers == msg.mentions:
await msg.channel.send(msg.author.mention)
else:
return
【问题讨论】:
-
请包含所有相关代码和数据。请参阅:minimal reproducible example、How to Ask。
标签: python bots discord discord.py discord.py-rewrite