Advice for programming structure for a chatbot

To clarify, what I have in mind is a class that abstracts the multiple connections your bots need to communicate with the server:

  • At the beginning, the manager opens a connection/socket for every mode that you require (see previous post).
  • At any time one of your bots wants to join a new channel, it joins within a connection that is below a certain incoming load that you have specified. If there is none available, it creates a new one.
  • Every time a bot wants to send a message it distributes this to a connection that is within the outgoing limit. I monitor the message rate like this. This does not have to be through a connection that has joined the target channel, since you can send messages to channels you haven’t joined. If none is available you create a new connection, but to minimize this delay you can do this some time before reaching the cap.
  • A timed method removes unnecessary connections and/or redistributes joined channels over connections.
  • Incoming messages are distributed to the bots that listens to this channel.

I’ve recently started developing within Twitch, and currently don’t need multiple connections. These are just some ideas that I might implement in the future.

1 Like