【发布时间】:2022-10-05 14:47:08
【问题描述】:
我想在日志通道中发送日志消息,但为此我需要日志通道对象。
因为我使用了不和谐的交互来定义我的机器人,所以我不能使用 get_channel(id) 方法。我在discord-interactions documentation 中找不到通过 id 获取频道的方法。
提前致谢。
bot = interactions.Client(
token = my_token,
intents = interactions.Intents.ALL
)
logs_channel = bot.get_channel(channel_id = 1015371164312424468)
Traceback (most recent call last):
File "[...]", line 17, in <module>
logs_channel = bot.get_channel(channel_id = 1015371164312424468)
AttributeError: 'Client' object has no attribute 'get_channel'
【问题讨论】:
-
你试过
fetch_channel()吗? -
您使用
discord-interactions而不仅仅是discord.py有什么原因吗?交互是 PyPi 上 v2.X 的一部分。 -
ConnerWolf08:我刚刚尝试过,但它不起作用,但我认为这是因为@stijndcl 是对的。明天我将重写我的代码并发布更新。谢谢您的帮助
标签: python discord.py discord-interactions