Currently having an issue with my Twitch chat bot, this error occurs when the bot picks up JTV sending a flag to op somebody in the channel (Giving them mod permissions).
The problem I'm having is that this error sometimes occurs and sometime doesn't. Due to this, I cannot have a stable process of this running on my VPS. Any help?
message = ' '.join(line)
x = re.findall('^:jtv MODE (.*?) \+o (.*)$', message) # Find the message
if (len(x) > 0):
channel = x[0][0]
if (channel not in mods): # If the channel isn't already in the list
mods[channel] = []
list = mods.get(channel)
list.append(x[0][1])
print(mods) # Print updated list with new mods
Here is where I remove them as well, Not sure if this might incur an error or not. But I will post it nonetheless...
# Removing mods
y = re.findall('^:jtv MODE (.*?) \-o (.*)$', message)
if (len(y) > 0):
channel = y[0][0]
if (channel in mods):
mods.get(channel).remove(y[0][1])
print(mods)
From what I can see here the 'list'
list.append(x[0][1])
must sometimes be a string, not a list. So maybemods.get(channel)
sometimes returns a string. One solution might be to check if you got a string this time,type(list) == str
and don't do the append. Unfortunately that's all I can tell you. Maybe look inside mods.get() and see why it would do that.