Code Monkey home page Code Monkey logo

twitchcubiebotgui's Introduction

TwitchCubieBotGUI

Twitch Bot focusing on aggregating votes and averages from Twitch chat, with a GUI


Explanation

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 some amount of seconds after the messages comes in. For how long a message is stored after it comes in, and can be used for a vote, can be edited in the Settings section. If at some point someone decides to calculate a vote or average, this stored information 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.

This is an extention of my existing TwitchCubieBot program, but now with a convenient and simple GUI: image

An explanation of this GUI will be provided below the explanation of the bot itself.


Voting

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.


Averaging

Command:

!average [min] [max]

This command will average all numbers between min and max send in the last 3 minutes. Example:

!average 0 100

Examples

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 0 100 was typed by someone with the appropriate rank:

Average is 67.38%.

Settings

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"
    ],
    "LookbackTime": 30,
    "AllowedPeople": [],
    "Sub": 1,
    "SubGiftBomb": 1,
    "SubGift": 1,
    "AverageResults": 1,
    "AverageCommandErrors": 1,
    "VotingResults": 1,
    "Votes": 1,
    "VotingCommandErrors": 1,
    "Numbers": 1,
    "SaveChat": 0
}
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

Everything below this point is linked to the Settings page of the GUI, explained below.

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/.


GUI

Some of the values from the settings.txt file can also be edited in the GUI. For reference, this is the GUI:

image

Let's clarify the functionality from the GUI:

Button Action
Auth This button will hide or unhide your Authentication token. This way you can hide it when you aren't changing it, so that it will not leak.
Stop This button is both "Stop" and "Run" at the same time. When the bot is running, the button will say Stop. While it is not, it will display "Run". Pressing this button will either stop the bot from running, or start the bot using the information filled in above.
Clear Clears the console below
Vote Equivalent to typing !vote in chat. Calls a vote.
Settings Opens up a popup message, as shown on the left side in the screenshot.
Save & Close Closes the setting popup message, and saves the settings.

Note that the settings in the popup message refer to what will be shown in the console in the main GUI. This is the meaning of each section:

Name Meaning
Sub If regular subscriptions should show up in the message box.
Sub Gift Bomb If sub mystery gifts (a handful subscriptions gifted to several randomly picked users) should show up in the message box.
Sub Gift If regular subscription gifts should show up in the message box.
Average Results If the results from !average min max should show up in the message box.
Average Cmd Errors If errors from incorrect usages of !average should show up in the message box. Eg: No recent numbers found to take the average from or Max parameter should be larger than Min parameter.
Vote Results If the results from !vote min max or !vote should show up in the message box.
Votes If individual votes should show up in the message box. Eg: A or Y.
Vote Cmd Errors If errors from incorrect usages of !vote min max or !vote should show up in the message box. Eg: No votes found. or Max parameter should be larger than Min parameter.
Numbers If individual numbers should show up in the message box. Eg: 23.0 or 12.4.

Requirements

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.


Other Twitch Bots

twitchcubiebotgui's People

Contributors

tomaarsen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

twitchcubiebotgui's Issues

How to install it

It seems pretty nice and perfectly what I was looking for. I'm new with this kind of bot. How should I install it. What should I do to implement it on my stream ?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.