![](/img/trans.png)
[英]Discord Python - How to make the BOT say all the messages of a channel?
[英]python Discord Bot how to send messages from one channel to another
async def on_message(message):
if message.channel == (720020927668289588):
await Bot.get_channel(703707652710072515).send(f"{message.author.name}: {message}")
await Bot.process_commands(message)
我試圖讓機器人在有人在通道 1 中發送消息時將消息發送到通道 2 我當我輸入通道 1 時沒有任何反應並且沒有消息發送到通道 2 並且控制台中沒有錯誤
我已經整理好了
message.channel
返回一個頻道 object,您正在嘗試獲取 id。 您可以將message.channel
替換為message.channel.id
以獲取頻道 ID。 然后代碼將起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.