Twitch Bot focusing on aggregating votes and averages from Twitch chat
When the bot has started, it will start listening to chat messages in the channel listed in the settings.txt file. All messages will be parsed, and votes and numbers will be stored for 3 minutes after the messages comes in. If at some point someone decides to calculate a vote or average, the information from the last 3 minutes will be used. This means it is not needed to start a vote or average in advance Note that if one user sends multiple votes or multiple values, newer values will override the older ones, so everyone only has one vote.
Note that this bot now has a new version with a GUI: TwitchCubieBotGUI
Commands:
!vote
This command will decide the winner between votes.
!vote numbers
This command will decide the winner between numbers.
!vote emotes
This command will decide the winner between emotes.
Valid votes (for A) include:
- A
- AAAAA
- A A A
- A Please
- All of the above, but with lower case a
Invalid votes include:
- I would really like that
- D I A L
Any single letter can be a vote.
Command:
!average
This command will average (median) all numbers sent in the last LookbackTime
seconds. See Settings for information on how to configure LookbackTime
.
The logging and chat output when !vote
was typed by someone with the appropriate rank:
B won with 74.24%.
The logging and chat output when !vote numbers
was typed by someone with the appropriate rank:
3.0 won with 84.72%.
The logging and chat output when !average
was typed by someone with the appropriate rank:
The average is 67.38.
This bot is controlled by a settings.txt file, which looks like:
{
"Host": "irc.chat.twitch.tv",
"Port": 6667,
"Channel": "#<channel>",
"Nickname": "<name>",
"Authentication": "oauth:<auth>",
"DeniedUsers": [
"streamelements",
"marbiebot",
"moobot"
],
"AllowedRanks": [
"broadcaster",
"moderator"
],
"AllowedPeople": [],
"LookbackTime": 30
}
Parameter | Meaning | Example |
---|---|---|
Host | The URL that will be used. Do not change. | "irc.chat.twitch.tv" |
Port | The Port that will be used. Do not change. | 6667 |
Channel | The Channel that will be connected to. | "#CubieDev" |
Nickname | The Username of the bot account. | "CubieB0T" |
Authentication | The OAuth token for the bot account. | "oauth:pivogip8ybletucqdz4pkhag6itbax" |
DeniedUsers | List of (bot) names who's messages will not be included in voting and averages. | ["streamelements", "marbiebot", "moobot"] |
AllowedRanks | List of ranks required to be able to perform the commands. | ["broadcaster", "moderator"] |
AllowedPeople | List of users who, even if they don't have the right ranks, will be allowed to perform the commands. | ["cubiedev"] |
LookbackTime | The amount of seconds the bot looks back for votes/numbers/emotes. | 30 |
Note that the example OAuth token is not an actual token, but merely a generated string to give an indication what it might look like.
I got my real OAuth token from https://twitchapps.com/tmi/.
- Python 3.6+
- Module requirements
Install these modules usingpip install -r requirements.txt
Among these modules is my own TwitchWebsocket wrapper, which makes making a Twitch chat bot a lot easier. This repository can be seen as an implementation using this wrapper.
- TwitchMarkovChain
- TwitchAIDungeon
- TwitchGoogleTranslate
- TwitchCubieBotGUI
- TwitchCubieBot
- TwitchRandomRecipe
- TwitchUrbanDictionary
- TwitchRhymeBot
- TwitchWeather
- TwitchDeathCounter
- TwitchSuggestDinner
- TwitchPickUser
- TwitchSaveMessages
- TwitchMMLevelPickerGUI (Mario Maker 2 specific bot)
- TwitchMMLevelQueueGUI (Mario Maker 2 specific bot)
- TwitchPackCounter (Streamer specific bot)
- TwitchDialCheck (Streamer specific bot)
- TwitchSendMessage (Meant for debugging purposes)