Hi,
Currently one feature of a chat bot I programmed is that it records chat lines to a database. I’d like to introduce a little bit more organization to this database by splitting up chat into “broadcasts”. My goal is, when a broadcast ‘starts’, to create a new entry in "broadcast’ database and start adding any messages from the twitch chat to this entry “broadcast#45”. When a broadcast ends, create a new entry in “broadcast” database “offline#45” where all chat messages after a broadcast are appended to. and repeat. To do this, I need some sort of marker for when a broadcast starts/ends.
The poor man’s solution I’m currently using is broadcast start = if the chat line contains the string “x viewers have resubscribed while you were away” and broadcast end = hosting someone else. This isn’t always reliable though, considering there may be a day where no resubscriptions happen between broadcasting sessions, or the streamer doesn’t host after a broadcast.
I also know that I can use this to determine what a broadcast status https://api.twitch.tv/kraken/streams/xxxxx, which includes the broadcast start time. I imagine I could check this every minute or so.
So to the expert developers on here: how would you recommend solving this problem?