可以使用 Discord 中的机器人将新消息从 X 服务器 Y channel 复制到我的 X 服务器 Y channel 吗? 我想要复制消息的服务器是我作为用户连接的官方游戏服务器(在 Discord 上),而我的服务器是这个游戏的公会服务器,我想要在其中发送新闻和更新公告。
对不起我的英语
最佳答案
使用 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)
当然,如果您愿意,您可以添加对文件附件、特定用户等的检查。
引用文献:
关于python - Discord 机器人将消息从服务器复制到我的服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62064577/