获取发送消息的通道的ID

问题描述 投票:0回答:1

我想做的就是找到发送消息的渠道。

Ex:

async def on_message(on_message): # Get Channel Id channel bot.get_channel(channel_id) await channel.send('test')

python discord.py discord.py-rewrite
1个回答
0
投票

您正在隐藏on_message。您应该将on_message对象命名为正在传递Message的名称,例如Message

on_message对象具有一个message,即发送消息的Message。该channel attribute对象还具有一个channel,它是通道的ID。

有关降价的帮助,请参见TextChannel。>>

© www.soinside.com 2019 - 2024. All rights reserved.