当另一个用户发布消息时,Discord.py 发送消息

时间:2021-04-24 13:46:27

标签: discord discord.py

我正在 discord.py 中创建一个机器人,并希望我的机器人在 Webhook 在特定频道中发送消息时 ping 一个角色。有没有办法做到这一点?现在我只有频道 ID,我很确定这是一个客户端事件

@client.event
async def pingrole():
  channel = client.get_channel("channel id")

1 个答案:

答案 0 :(得分:0)

async def on_message(message):
    if message.author.id == webhook.id:
        await ctx.send(role.mention)