Discord Bot argument of type 'NoneType' is not iterable

I’m working on a Discord Bot that is connected to my MySQL to give and receive Data. In this part of the code, I have a message event that toggles whenever a User/Client sends a message. I’m getting an "argument of type ‘NoneType’ is not iterable" error and I have no idea how to fix it and I couldn’t find any answer on the forums.

Traceback (most recent call last):   File "C:\Users\itzbe\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 312, in _run_event     await coro(*args, **kwargs)   File "C:/Users/itzbe/Desktop/Discord/Ency Bot/bot.py", line 37, in on_message     if str(message.author.id) in mutedList: TypeError: argument of type 'NoneType' is not iterable 

I would really appreciate it if one of you could help me solve this issue.

@client.event async def on_message(message):     immunity = 'SELECT userID FROM immunity WHERE userID = (%s)'     curs.execute(immunity, (str(message.author.id),))     immunityList = curs.fetchone()      muted = 'SELECT userID FROM muted WHERE userID = (%s)'     curs.execute(muted, (str(message.author.id),))     mutedList = curs.fetchone()      filter = 'SELECT word FROM filter'     curs.execute(filter)     filterList = curs.fetchall()      if str(message.author.id) in mutedList:         muted = message.author.mention + ' You are currently muted!'         await message.channel.send(muted)         await message.delete()      if message.author.id not in immunityList:         for word in mutedList:             if message.author.id not in filterList:                 if message.content.count(word) > 0:                     id = message.author.id                      getUserID = 'INSERT INTO muted (userID) VALUES (%s)'                     userInfo = (id)                     curs.execute(getUserID, userInfo)                     db.commit()                      getUserID = 'INSERT INTO user (warning) VALUES (%s)'                     userInfo = (+1)                     curs.execute(getUserID, userInfo)                     db.commit()                      msg = message.author.mention + ' said ' + '**' + message.content + '**' + ' and has been set in a Timeout!'                     await message.delete()                     await message.channel.send(msg)      await client.process_commands(message) 
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.