It sounds like you are exceeding the message rate limits for IRC. These are the total rate limits across all channels, instead of the limits on a per channel basis. You will be banned for 30 minutes if you exceed either of the limits listed here: https://dev.twitch.tv/docs/irc/guide#command–message-limits
Also make sure you are properly replying to PING :tmi.twitch.tv with PONG :tmi.twitch.tv so you are not disconnected prematurely.