This Content is from Stack Overflow. Question asked by Leums
I would like to send logs messages in a logs channel, but for that I need the logs channel object.
Because I used discord interactions to define my bot, I can’t use the
get_channel(id) method. I can’t find the method to get a channel by id in the discord-interactions documentation.
Thanks in advance.
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'
You can use
logs_channel = await interactions.get(bot, interactions.Channel, object_id=your_channel_id)
To get the channel.
You can also join the support server as you would receive help faster
This Question was asked in StackOverflow by Leums and Answered by Ed Vraz It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.