【发布时间】:2021-02-18 11:04:03
【问题描述】:
我一直在制作一个机器人,它将对消息做出反应的人添加到数组中,然后在达到目标后将@的每个人都添加到数组中。我已经让它发出应该@每个人的消息,但它只显示文本而不是实际通知人们。 “Names”是它收集的列表,“send_out”应该对其进行格式化。
@client.event
async def on_raw_reaction_add(payload):
if payload.message_id == messageid and payload.member.bot == False:
if str(payload.emoji.name) == "????":
name = str(payload.member.name + "#" + payload.member.discriminator)
global count
count += 1
global names
names.append(name)
print (names)
if (count == goal_actual):
print("Goal has been reached.")
channel = client.get_channel(channel_id)
await channel.send("We now have " + str(goal_actual) + " for " + game_actual + "!")
print(channel)
global send_out
for x in names:
send_out += ("@" + x +" ")
await channel.send(send_out)
send_out = []
else:
print("Detected reaction from " + name + ". There are is now " , count , " people ready.")
【问题讨论】: