It’s likely not my framework, since reader.readline() simply isn’t getting the data even if I don’t do anything with it. Does anyone know why this happens? Or is it just because I have a smaller channel and thus a smaller priority?
Is your bot a moderator? If not, you may just be seeing intentional chat delay that allows moderators time to timeout/ban users before the general public sees the chat. (If you’re already a mod, this wouldn’t apply)
Are your timestamps showing minute:second or hours:minute? If it’s hours:minutes you should include seconds for better measurement.
It is moderator already. I’ll see if I can make bttv set timestamps to include seconds, because I literally copied this from chat. For my current code, here is what I’m using for my bot.
Weird - have you tried using it in a larger channel? Should be able to determine that way if the delay is originating from Twitch or if it’s something on your side (unfortunately I am not very familiar with Python so I won’t be the most apt person to review.)
Please remove your client id from the public repository, while it’s public you usually don’t want to pass it around to make it easier to hijack. (Just include it with config.get)
I don’t know Python (I’m a c# guy), so let me ask a question I’ve seen in the past before someone more knowledgeable in that space comes by:
Are you using a library like twisted so your command processing doesn’t block your listener thread? (I see something called async twitch, but that only works if you have the processing happening off the listener)
The message parsing is all that’s blocking as far as I can tell. (Even though it only takes less than half a second). I’m not using library other than re (python’s regex module)
An event loop runs in a thread and executes all callbacks and tasks in the same thread. While a task is running in the event loop, no other task is running in the same thread.
I’m voting that its something in your code as well, as 3ventic suggests, because the delays you see in b0aty’s channel is still quite larger than I would expect to see.
For example, I went into b0aty’s channel and did the same exercise with my bot and the time stamps are ~1 second apart as one would expect (excluding delay for non-mods, but I think you circumvent that if you are connected via IRC anyways)