Answer the question
In order to leave comments, you need to log in
TypeError: 'TextChannel' object is not iterable?
I wrote a message parser for a bot in the discord. You need to get the channel id from the database (sql3) and get the channel itself through self.bot.get_channel(). But at the output I get the following error:
The code itself (the database is open, it gets it without problems!):
TypeError: 'TextChannel' object is not iterable
@tasks.loop(hours = 1, reconnect = True)
async def get_messages(self):
""" Porting con.CM_COUNT messages to database. """
system.execute("SELECT codes_id FROM system")
channel_id = system.fetchone()[0]
system.close()
channel = self.bot.get_channel(channel_id)
for message in channel:
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question