Custom, extensible, work in progress chatbot for twitch.
Borkedbot is a python IRC bot built for twitch.tv chats. It interfaces with Steam and Dota 2 through node-steam and node-dota2, along with accessing the Steam and Twitch APIs. Borkedbot currently runs on Python 2.7 in a linux environment. No guarentees are made about stability, and some features are limited by the twitch and steam API's availablity.
Most, if not all, of these pagkages can be installed via pip.
For Steam (non-API) and Dota 2 related functionality a running instance of node-steam with node-dota2 is required. See dota.js for more information.
Borkedbot is designed to be interfaced almost entirely through chat. Stuff and things.
Redis settings keys may be manually changed for debugging or maintence reasons, but is usually not needed. It should be noted that keys are in python pickle format. Importing the settings module from an interpreter is the suggested method of interaction.
Commands are currently created manually per channel, with some that can be used across channels. Part of the upcomming command overhaul will be the ability to create simple commands through chat. Complex commands will probably still need to be created manually. The new command system may include a way to generate an information page automatically or on demand in the future.
Commands have varying levels of permissions and rules regarding when and in which channels they are active for. They can be disabled per channel by request of the channel owner. Commands that only work for the bot host (imayhaveborkedit) will be ommited due to irrevelance to the following section.
List is highly subject to change, see chatrules.py for the most current commited commands.
[arg]
- Optional argument.<arg>
- Required argument.'arg'
- Literal argument. The word in quotes is the argument. Multiple arguments without quotes are considered literals as well.arg1 | arg2
- Multiple arguments. Either can be used, ex:!command arg1
or!command arg2
The permissions tree is as follows. Highest permissions on the left, lowest on the right.
Special
> Broadcaster
> Mods
> Subscribers
> All
Only the bot host (imayhaveborkedit) can use these. Usually reserved for test commands or other convience commands.
The rest should be self explainatory.
These commands work in all channels by default, but may be blacklisted for certain channels.
Says how long the channel has been streaming for. If used in a channel that is currently hosting another, the command will return the uptime for the hosted channel instead.
[channel]
- Optional argument to get the uptime of another channel.
Generates a sentence using markov chains from words collected from chat. Use at your own risk.
[two word seed]
- Takes two words and tries to create a sentence using those to start with. Typically inferior to using the command without the argument.
Ask borkedbot a question and his magic 8 ball will give you an answer. Message must end with a question mark.
...
- Some question that you want to ask.
Returns a link to the github page. You probably found this page that way.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Creates or manages recurring events. Recurring events are automated messages that will be said in chat at an arbritrary interval, rounded to the nearest 5 seconds. This system is unstable, do not expect much. It works, but just barely. Events are not restarted after the bot restarts, and possibly if the bot is disconnected from irc and reconnects.
[new]
- Create a new recurring event.<name>
- The name of the event. Names may not have the character ' or spaces in them.<timeout>
- Number of seconds to wait between messages. Rounded to the nearest five. Must only contain numbers.<message...>
- The message to say. The rest of the message is consumed, spaces and all.
[del]
- Stop and delete a recurring event.<name>
- The name of the event. Names can be found with thelist
option. Only one name is consumed.
[delall]
- Stop and delete all events.[set timeout]
- Change the frequency of the event. More options will be added in addition totimeout
.<name>
- Name of the event.<timeout>
- Number of seconds to change the timeout to.now
- Optional flag to imediately trigger the event instead of waiting for the timeout.
[start]
- Starts a stopped event.<name>
- Name of the event.
[stop]
- Stops a running event.<name>
- Name of the event.
[skip]
- Resets the event's timeout, effectively restarting it.[list]
- List the names of all running events.[status]
- Status information of all events (running or stopped).[name]
- Requests running status on a single event instead of all events.
[dump]
- Dumps all event data to the console. Not intended for use by anyone other than the bot host.
These commands work in all channels if the channel is enabled for something, i.e. Dota related commands work in Dota related channels.
Displays the streamer's Dota 2 ranked MMR.
update
- Mods Only - Requests a manual update of MMR. Not usually needed as borkedbot should keep track of MMR already.
Returns a link to the streamer's dotabuff if Dota features are enabled.
Identifies notable players in the streamers current match. Command searches through the live games data, the same data in the Dota 2 'Live Games' tab. Notable players are defined as:
- The dotabuff verified players list
- Streamers who have Dota features enabled (not yet implemented)
- Other streamers of note on twitch (not yet implemented)
Will be removed in the future in favor of an automatic system.
[pages]
- Number of pages to search through. Every page has 6 games on it. Defaults to 8. High level ranked matches with pro players are more likely to be at the top of the list.
Setup command to register a streamer with borkedbot and enable dota features. The process goes as follows:
- Streamer types
!mmrsetup
and Borkedbot replies with instructions. - Streamer types
!mmrsetup
with theaddme
oraddyou
options. - Streamer somehow adds Borkedbot as a friend on steam.
- Borkedbot may initiate a steam chat with that person (if that feature isn't broken), otherwise the streamer says
enable mmr
in steam chat. - Borkedbot generates a code for the streamer to verify with in chat.
- Once verified, Borkedbot congratulates you on a job well done and Dota features are enabled.
[help]
- Displays information about the command.[addyou]
- Returns borkedbot's steam profile link and a steam uri link for use with theWin+R
Run dialog.[addme]
- Requests that borkedbot attempt to add the broadcaster from...<steam thing>
- A steam profile link, id, vanity name, dota id, etc. Borkedbot's will be used as an example. Valid options:- Steam Community profile link, either work:
http://steamcommunity.com/profiles/76561198153108180/
http://steamcommunity.com/id/Borkedbot/
- Or just the end part:
76561198153108180
Borkedbot
- Dota ID (can be found on your dota profile):
192842452
- The other Steam ID that looks like this:
STEAM_0:0:96421226
- Steam Community profile link, either work:
[verify]
- Verifies the streamer with borkedbot and enables dota related features in the channel.<code>
- Code given to the streamer by borkedbot through steam chat to verify themselves.
Configuration command for dota related settings. More options will be added in the future.
[status]
- Currently displays if MMR features are enabled. Will show more information in the future.[setname]
- Sets the name that will be used to refer to the streamer.<name>
- Said name.
[enable]
and[disable]
- Enable and disable the following features:<dota>
- Dota related functions<mmr>
- MMR related functions
Manages a private lobby in Dota 2. This command is part of the upcomming subgames feature. Limitations imposed by node-dota2 prevent lobbies from being configured past creation, meaning options like All Chat and cheats cannot be changed. Lobby chat also cannot be joined. If these things bother you, complain to rjackson about it.
Unlike most commands, this command parses options using argparse. The first option will be the top level items in the Arguments section, and additional options are defined using -option value
format.
create
- Create a new lobby. Only one lobby can be active at a time, across all instances of borkedbot using a particular steam account.-name lobbyname
- Name of the lobby. May contain spaces. Defaults to "Borkedbot lobby".-mode gamemode
- Sets the lobby gamemode. Gamemodes are lowercase abbreviations of the full name. Defaults to All Pick.ap
- All Pickcm
- Captains Moderd
- Random Draftsd
- Single Dragtar
- All Randomrcm
- Reverse Captains Modemo
- Mid Onlylp
- Least Playedlh
- Limited Heroesad
- Ability Draftardm
- All Random Death Match (ARDM)1v1
- 1 vs 1 Midrap
- Ranked All Pick (All Draft)
-server region
- Defines which server the game will be hosted on. Defaults to Automatic.auto
uswest
useast
europe
korea
singapore
australia
stockholm
austria
brazil
southafrica
perfectworldtelecom
perfectworldunicom
-password pass
- Sets the password for the lobby.-randompassword
- Generates a random password for the lobby. This option is mutally exclusive with the-password
option. Note: There is as of yet no way for the streamer to know what password was generated. This will be fixed in the future, probably by having borkedbot message the password to the streamer on steam.
leave
- Leaves the current lobby. Lobbies will automatically be left once the game has started.remake
- Re-creates the lobby, leaving the old one and generating a new one. Can use all options thatcreate
can.start
- Starts the game and leaves the lobby.shuffle
- Preforms a balanced shuffle of the players in the lobby.flip
- Switches the teams of all players in the lobby.kick
- Kicks a player from the lobby. Not yet implemented.status
- Displays if a lobby is in use. Functional, but unfinished.showpassword
- Displays the lobby password in chat. Usually used when deciding to open the lobby up to all users in chat.help
- Displays a list of lobby options. This list is probably what you want though.
These commands are not related to a specific feature, but rather made or function for specific channels only. Currently all commands are defined in chatrules.py, but this will change after the command overhaul.
Displays information about the mumble server.
Displays monkeys_forever's rank and MMR on the official Dota 2 leaderboards.
Attempts to invite user to monkeys_forever's subscriber guild. Subscribers only have one invite slot. Successfully using the command again will kick the previously invited person from the guild. Mods may designate a user to invite if needed.
Typical output: Success message, error message, or help message, depending on user supplied argument.
[steam thing]
- Some reference to a user's steam account. Uses the same input resolution code that !mmrsetup
does, see arguments for reference.
[target user]
- Mods only - Name of user to manually invite, if they for some reason cannot figure out what user they are.
Returns the Dota 2 post-match blurb for the previous game. Will be a Feature Specific command in the future.
Returns the link to monkeys_forever's playlist.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Encourages the user to widen their occular orifices. The song is always in the top left guys. It always has been, and always will. Sorry mobile quality users.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Gives the user instructions on how to do the persistant loading screen background bug in Dota 2. Some have said that only dota_embers 0
is need but I'm not convinced.
Typical output: {user}: It's a bug with the TI2 animated background. Launch option: "-dashboard international_2012" Console command: "dota_embers 0" Then close, open, and close your console, and play a game.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Gives the user the console command to enable the range finder in Dota 2.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Oh well monkeys, you tried your best.
[user]
- Prepends the output with the supplied user instead of the one who invoked the command.
Links to plug superjoe's various things of intrest.
Courtesy of Slayerx1177
Convience command for listing the youtube and twitter links.
Returns the current time where superjoe is (EST).
Convience command for listing the facebook and twitter links.
Main file for commands. All commands are created and processed from this file. The command system is pending overhaul, and will be removed in favor per channel importing.
Logs chat to a file. Can be used in conjunction with an IRC stats page like this.
Command class definition file. Used by chatrules.py for processing commands. Pending command system overhaul.
Interfaces with the node process and steam api to provide dota/steam related functionality.
- Accurate MMR data on request for enabled streamers. Requires adding the bot as a friend on steam and public profile.
- Post match data with MMR difference, steam api allowing. Match information is gathered from the steam api, while MMR difference requires the previously mentioned condition.
- Mentioning of notable players in game. Notable players are definied as the Dotabuff Verified Players list plus streamers. (WORK IN PROGRESS, NOT YET COMPLETE)
- Lobby management. Limited by node-dota2 functionality. Work on this feature will be resumed during the subgames introduction.
- Helper functions for steam related things.
Module for unsorted, testing or temporary events that have no proper parent module. Code here is usually temporary and will be moved to its own module eventually.
Events related to dealing with hosted channels on twitch.
- Says message upon notification that a stream is being hosted.
- Automatic unhosting of channels after target channel is offline for an arbritrary ammount of time. (FEATURE BROKEN, CURRENTLY DISABLED)
Takes messages from twitch chat and breaks them up for use in markov chains. Sentences generated from the current databade are probably run on sentences and reference Dota in some way. Don't say I didn't warn you.
Moderation rules for channels. Will not be commited for obscurity purposes.
Interface for the node-steam process. Contains mostly wrapper functions to ensure arguments are passed properly.
Some weird system I thought up some day, started, made 0 progress on, and forgot about. May or may not be deleted.
Module for handling recurring events, triggered by the timer
event from the main bot.
Interface for redis database. Keys are stored in python pickle format for convient storage and parsing of complex python constructs.
Interface for the Steam API. Access key is required. (TODO: add link to steam dev page thing)
Interface for the Twitch API. Key does not seem to be required but may be in the future.
- Command overhaul
- More mmr stuff tracking or whatever
- timed key addition to settings
- fix auto unhosting
- folder module loading for import overhaul
- addition of information to the borkedbot steam page (online/ingame/offline etc)
- Multiple dota accounts, switching depending on which one is in game
I guess that's good enough for now I'll add more later.