Tuesday, April 21, 2015

[Planned] XwitchBot3

    Welp I haven't worked on/updated XwitchBot2 in forever but I do want to get back to it but I don't think anyone is using the plugin system to the extent I wanted, I don't think anyone besides myself has made any plugins for it. I don't plan on removing the plugin system or anything like that, if anything I want to expand it even more. I will be planning on potentially a third version of XwitchBot, one that is hopefully more polished then XwitchBot2. Now this is planned, whether or not it will ever be completed is another matter completely as I will be working on this in private if/when I am. I just wanted to say that I have been thinking about how XwitchBot's development has been, or lack thereof and wanted to stop neglecting it lol.

    Of course every reversion of XwitchBot has had a GUI overhaul and I think XwitchBot3 will be no different in that it too will most likely get a GUI overhaul. I'm picturing something similar to steam's UI but its not concrete yet a concept. There are other features that I think will benefit XwitchBot like possibly implementing some form of scripting. I don't know if I will be using an already available language or Frankenstein my own if I do plan on implementing one, of course implementing an existing one sounds much more practical.

    While this will be a reversion many aspects will be reused from XwitchBot2 just like how many aspects of XwitchBot2 were from XwitchBot. Things like I said the plugin system are there to stay, and the TwitchAPI from XwitchBot2 will still play a big part. I don't know what this blog post will ultimately amount to if anything but it's just ideas that I have been thinking about and of course if this comes to fruition XwitchBot3 is free, and will always be free like its always been.

UPDATE 8: Just another screenshot after fixing some UI alignments with some actual channels


UPDATE 7: Worked on the UI for each channel, some things are working now, still need to move several things around and implement others. Added donate button and home button that will eventually link to XwitchBot3 page but here is what it looks like so far:


UPDATE 6: Redoing the UI. It will be similar to XwitchBot2 versions but with adjustments to accommodate the new features. It isn't complete but much has been done. Currently it can connect to Twitch, Login using OAuth, Join channels. It cannot display messages or send them yet.


UPDATE 5: Got multichannel fully implemented and working, it also keeps track of the users in each channel. Added several MessageTypes for ease of plugin creation. Added proper parsing of initial twitch userlist (irc 353) and also added a type to tell the bot when the userlist ends (irc 366). Bot can only see registered users in the chat so the number of people shown on the bot vs the number of people on the stream will differ. Added MessageType (irc 421) for unknown commands so the bot notifies the user of any mishaps. Added parsing for originating channel of a message because the bot now has to keep track of messages from multiple channels. I will be implementing the ACTION aka /me MessageType and also the Points system as well as the AccessLevel system (differently levels have permissions to do different things). I also plan on slightly modifying the UI but only slightly since V2 UI is good enough.

UPDATE 4: Worked a bit on the YoutubeRequest class again. Added a bit more of the iframe API, I don't think ill add anymore of the API. Added a check for songs that don't start. Once a song is set to be played, and failed to start playing within 5 seconds the song will be skipped and the next song will be set to play. The duration to wait and see if the song starts can be changed (in milliseconds) in the constructor. There are 2 added events to the YoutubeRequest class. A polling event which presents the player's status such as song duration in seconds, the percentage of the song thats been buffered, the current position in seconds of the song, if the video is muted, and the current song's volume, as well as the current players state (is it playing, paused, etc), this polling is triggered every half second.

UPDATE 3: Well I will be changing some changes from UPDATE 2. In UPDATE 2 I planned on having the IRCclient be able to have multiple instances meaning each IRCclient establishes its own connection to the twitch server. I originally thought that because twitch's IRC is broken it couldn't join different channels through just one connection. From the website each tab I'd imagine creates a new connection and so I went to do it that way. Today though I remember a few of my friends who use HexChat to connect to twitch chat and I think I remembered them saying they can connect to different channels and so I went and tested. I can indeed connect to different and multiple channels. So I will be changing the bot in that respect. There will only be one instance of the IRC client again but It will be modified to handle multiple channels. I have also improved the message buffers and made the Message Structure simpler. The UserList is now moved inside of the IRCclient Class (it cant manage multiple channels yet, but will get to it). Because the PONG reply to PINGs is always the same (PONG :tmi.twitch.tv) I made it so that it replies only that and removed all parsing of the PING messages. When a PING is received a predefined byte array containing (PONG :tmi.twitch.tv) will be sent. Added more exception handling. Date/Time of messages in timestamps are set when the messages are received compared to previously where the Date/Time were set when the message was displayed in the chat. Sent message structure also has Date/Time now instead of setting the time when the message is displayed (this might be more accurate but timestamps might be out of order when displayed, I might change it back to how it was depending on how it turns out).

UPDATE 2: Reworking the core of the bot today. I made the IRCclient for the bot more robust. Put the message formatter (made because twitch's IRC protocol is broke as all hell) inside of the IRCclient class so that each instance of the IRCclient has its own formatter. Put the received message buffer and sending message buffers inside of the IRCclient class so that each IRCclient instance has its own buffers for the ability for multiple instances of an IRCclient (for multiple connections ex: connecting to multiple channels). Each IRCclient instance will have their own configuration (Server, Port, Channel, Nick, OAuth, etc). UserList parsing will also be available to each IRCclient instance so that it doesn't bunch users from all channels. Going to be moving the IRCclient class to Core class so plugins can access the IRCclient class (instead of making their own, which is a waste of time). Added PONG priority which will hold off on sending normal message so that PINGs are replied with PONGs sooner than later. Will be making a base class for the plugins interface so instead of implementing the XBPlgn interface, you inherit the XBextension class (you can still implement the interface if you want). Will be adding a database to the core of XwitchBot to keep records of things for the bot and for plugins as well (if needed). There will only be one instance of the database so that there is no conflicting records between plugins and the bot itself.

UPDATE 1: Worked on YouTubeRequest. Made a new class that implements more of the youtube player iframe API. It can play, pause, stop, seek, set volume, get duration and get the buffered percentage. I plan on reworking the plugin interface, and move the plugin system out of the bot and into the points system I will be implementing. The flow looks like this:
Messages>IRCclient>RecievedMessagesBuffer>PointsSystem>PluginSystem>Plugins
That way people can decide which plugins require points to use without programming each plugin to do so. I do plan on a UI overhaul but haven't yet thought of anything concrete.