【问题标题】:Bot send message after user click on reaction and when he delete his reaction (python, discord)机器人在用户点击反应后发送消息,当他删除他的反应时(python,discord)
【发布时间】:2021-07-06 22:56:47
【问题描述】:

我在 dc 中有两个频道:

  • Channel_a
  • Channel_b

Channel_a 对用户关闭。 他们可以看到这个频道,但他们不能写。他们只能点击反应。

我需要一个机器人,当有人点击反应时,机器人会在 channel_b 中发送消息,@nick 点击这个反应的用户。

例如。具有 nick @Professore 的用户单击反应:一个:。在 channel_a 我们有

此机器人在channel_b中发送消息后:

当用户拥有 nick @Professor 删除他在 channel_a 中的反应时,机器人将在 channel_b 中发送另一条消息。

谁能帮我完成这个?

【问题讨论】:

  • 请添加更多相关代码和您用于实现该功能的 API。

标签: python discord bots


【解决方案1】:

@client.command(别名=['click']) 异步 def 游戏(ctx): 表情符号=':一个:'

def check(reaction, user):
    return user == ctx.author && str(reaction) == emoji
message = await ctx.send("Just click here:")
await message.add_reaction(emoji)

try:
    await client.wait_for('reaction_add', timeout = 30.0, check = check)
    await ctx.send('Hello @rs10 user')
except:
    await message.delete()  # The message will be deleted if the user doesn't react with :one: within 30 second

我发现了类似的东西并尝试使用它。这很难;/

【讨论】:

    猜你喜欢
    • 2020-04-29
    • 2019-12-24
    • 2020-07-31
    • 2020-08-02
    • 1970-01-01
    • 2020-08-12
    • 2020-03-13
    • 2021-07-04
    • 2021-06-04
    相关资源
    最近更新 更多