Okay so, I will explain what Im doing here: I want my bot to read a specific channel, and any message sent in that channel (no matter what, who, pic, gif, embed) the bot will send it in a thread itself, so I've asked the AI and I got this:
itents.messages = True
@client.event
async def on_message(message):
if message.channel.id == 1166507853314539561:
thread = client.get_channel(1209617468188925993)
if message.content:
await thread.send(message.content)
for embed in message.embeds:
await thread.send(embed=embed)
With this code the bot is reading the source channel, but he is not reading the thread channel, I think the client.get_channel is not working with a thread, I can use a channel ID and it works, but dont send the message, so the problems are:
- client.get_channel doesnt work with a thread
- The bot is not sending the readed messages in the second channel.
this is just a part of the code, the imports and the startup for the bot is ready.
I need my bot to read a channel and sent the messages from that channel in a threat.
Why you aren't getting the thread
client.get_channelfetches from the cache and only gets the channel. What we want is the thread.What to do instead
channel.get_thread(thread_id)will work instead.Code in context:
Documentation:
Note: I haven't tested the code I made before, but I believe it should work