Discord Python-如何使BOT声明频道的所有消息?

时间:2018-10-25 11:17:15

标签: python discord discord.py

有人知道如何让BOT说出频道的所有消息吗?

1 个答案:

答案 0 :(得分:1)

您可以编写一个on_message事件,以回显该频道中其他人发送的消息的内容。

from discord.ext import commands

bot = commands.Bot(command_prefix='!')

channel_ids = ("1234", "5678")

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    if message.channel.id in channel_ids:
        await bot.send_message(message.channel, message.content)
    await bot.process_commands(message)

bot.run("token")