Discord bot将邮件从服务器复制到我的服务器

时间:2020-05-28 12:21:23

标签: python bots discord.py

是否可以使用Discord中的bot将新消息从X服务器Y通道复制到我的X服务器Y通道? 我要从中复制消息的服务器是我作为用户连接的官方游戏服务器(在Discord上),我的服务器是该游戏的行会服务器,我想在其中发送新闻和更新公告。

对不起,我的英语

1 个答案:

答案 0 :(得分:0)

使用on_message()事件当然可以实现:

@bot.event
async def on_message(message):
    await bot.process_commands(message) # add this if also using cmd decorators
    if message.channel.id == THEIR_CHANNEL_ID_HERE:
        target_channel = bot.get_channel(YOUR_ANNOUNCEMENT_CHANNEL_ID_HERE)
        await target_channel.send(message.content)

当然,如果需要,您可以添加对文件附件,特定用户等的检查。


参考: