Babblebot

Babblebot is an open-source twitch chat bot in active development, originally developed for unique features in chocoTaco’s channel, now available to everyone with free hosting at http://babblebot.io.

Features

  • Web control panel with song requests and more
  • Advanced moderation features
  • Discord and other social integration
  • PUBG and Fortnite game integration
  • Useful native commands and programmable command variables
  • Local computer integration for fun and unique stream interactivity

Support

If you have any questions or are having issues, feel free to message me on discord: toovs#7544

Documentation

Installation

Install rust on your system: https://www.rust-lang.org/tools/install

I use the nightly branch:

$ rustup default nightly

Clone the repo and run the build script:

$ git clone https://gitlab.com/toovs/babblebot
$ cd babblebot
$ ./scripts/build.sh

Copy the .example files and modify as needed:

$ cp Rocket.toml.example Rocket.toml
$ cp Settings.toml.example Settings.toml

Run the bot:

$ ./bin/babblebot

Control Panel

Dashboard

Change stream and account related settings here. If you have an active patreon subscription you’ll be able to connect a twitch account to use as a custom username for the bot.

Notices

For now, intervals must be a multiple of 60; may change in the future.

Moderation

Manage a list of regexes for each chat message to be filtered through, and the user timed out if a match is found. For supported syntax, visit: https://docs.rs/regex/1.2.1/regex/#syntax

Keywords

Manage a list of regexes for each chat message to be filtered through, and a command to be run if a match is found. For supported syntax, visit: https://docs.rs/regex/1.2.1/regex/#syntax

Song Requests

This audio player will play through the current song request queue.

Integrations

Manage your social integrations. If you just subscribed to patreon and still don’t see the custom username option on the main dashboard, try refreshing your patreon integration here.

Logs

Use this for debugging purposes and to inspect recent log output generated from the bot.

Local Integration

Description

This is a program that runs locally on the streamer’s computer, and simulates keystrokes when certain events are triggered. You can do some fun things with this like trigger an obs scene or when a certain amount of bits come in, have your in-game character emote or throw a grenade. Right now bits are the only event trigger, but if you have any other ideas just let me know.

Installation

Navigate to babblebot’s releases page and download the latest version of babblebot-local-integration.exe into a folder, along with your version of Config.toml. The secret can be obtained from your dashboard.

Settings

channel

channel:viewerstats

!set channel:viewerstats true

Enables the (watchtime) and (watchrank) command variables.

channel:host-message

!set channel:host-message (name) has just hosted us with (viewers) viewers! They were last playing (game) and you can find them over at (url).

A message to send to chat when you receive a live host. Available variables are: (url), (name), (game), (viewers).

channel:autohost-message

!set channel:autohost-message (name) has just sent us an autohost! They were last playing (game) and you can find them over at (url).

A message to send to chat when you receive an autohost. Available variables are: (url), (name), (game).

command

command:prefix

!set command:prefix ~

By default this is set to ‘!’.

discord

discord:token

!set discord:token ND34Njg3MzUoNjk4NTk1MzUy.XUohDg.WDTyDUGNSYUeqpqtmuyYEqoQ_F4

Obtained from the bot tab in your discord application’s control panel: https://discordapp.com/developers/applications/

discord:live-message

!set discord:live-message @here chocoTaco has gone live!

A message to send to a discord channel when you go live, embedded with stream information.

discord:channel-id

!set discord:channel-id 3860364856220

The channel id of the discord channel your going live message will show up in. https://support.discordapp.com/hc/en-us/articles/206346498-Where-can-I-find-my-User-Server-Message-ID-

discord:mod-channel

!set discord:mod-channel 4760384856201

The channel id of a discord channel you want to be able to execute commands in.

fortnite

fortnite:name

!set fortnite:name therealchocoTaco

Your in-game character name.

fortnite:token

!set fortnite:token afa7do97-bb38-4o7E-8ec5-3d9b9i9I73f2

Obtained from https://fortnitetracker.com/site-api.

pubg

pubg:name

!set pubg:name chocoTaco

Your in-game character name.

pubg:token

!set pubg:token 3YJ0eXAiOiJKViQ1LCJhbGc1O1J1UzI1N1J9

Obtained from https://developer.pubg.com.

stats

stats:reset

!set stats:reset 13

The UTC hour to reset various game statistics at, instead of clearing them at the end of every stream.

watchtime

watchtime:blacklist

!set watchtime:blacklist nightbot moobot

Blacklists space-separated usernames from the (watchtime) variables and point system.

Commands

clip

create and post a clip from the last 30 seconds of stream:

!clip

command

add or modify a command:

!command add [name] [content]

add or modify a command only mods can use:

!command modadd [name] [content]

remove a command:

!command remove [name]

create an alias:

!command alias [alias] [original]
ex. !command alias !addcom !command add

remove an alias:

!command remalias [alias]

commercials

run commercials:

!commercials run [num]

auto-run commercials every hour:

!commercials hourly [num]

set a notice to be posted to chat when commercials are run:

!commercials notice [command]

turn submode on during commercials:

!commercials submode [on/off]

counters

store a numeric value that can be used in command variables:

!counters set [name] [value]

increase a stored numeric value by one:

!counters inc [name]

echo

echo a phrase from the bot:

!echo [phrase]

Usage

!command add !timeout (cmd !echo /timeout (args 1))
> toovs: !timeout chocotaco
> Babblerbot has timed out chocotaco

game

set the game of the stream:

!game [name]

moderation

The moderation blacklist is managed via the web control panel. Supported regex syntax can be found here: https://docs.rs/regex/1.2.1/regex/#syntax

Links

add a domain to the whitelist:

!moderation links add [domain]

remove a domain from the whitelist:

!moderation links remove [domain]

allow subs to post links:

!moderation links allowsubs

disallow subs from posting links:

!moderation links blocksubs

Colors

allow colored messages in chat:

!moderation colors on

disallow colored messages in chat:

!moderation colors off

Caps

limit the number of capital letters in a message:

!moderation caps [limit] [trigger]
limit: a percentage of capital letters allowed in a message
trigger: minimum number of characters in a message required to trigger this filter

turn off caps filter:

!moderation caps off

Minimum Account Age

set the minimum account age, in minutes:

!moderation age set [num]

turn off minimum account age filter:

!moderation age off

Display Timeout Reasons

display timeout reasons in chat:

!moderation display on

do not display timeout reasons in chat:

!moderation display off

multi

return the currently set multistre.am link:

!multi

set current teammates for multistre.am link:

!multi set [streamer1] [streamer2] ...

clear current teammates:

!multi clear

notices

create a notice to be posted to chat every X seconds:

!notices add [secs] [command]

Usage

Notices will be handled intelligently and ones created with the same interval will be rotated through. For example:

!notices add 300 !command1
!notices add 300 !command2
!notices add 600 !command3

will result in one command being posted to chat every five minutes, in the following order:

!command1
!command3
!command2
!command3
!command1
!command3

!command3 is posted every ten minutes, and !command1/!command2 are alternated between.

permit

permit a user to post links in chat for the next 30 seconds:

!permit [username]

Notes

Don’t include an @ symbol in front of the username.

phrases

store a phrase that can be used in command variables:

!phrases set [name] [content]

set

add or modify a setting:

!set [name] [value]

songreq

add an entry in the song request queue:

!songreq [youtube_id]

Usage

The youtube id of https://www.youtube.com/watch?v=qqC-NjCayAA would be “qqC-NjCayAA”. There is a web player on the control panel that will play through the requested songs. Each user is allowed only one entry in the queue at a time.

title

set the title of the stream:

!title [content]

unset

remove a setting:

!unset [name]

Variables

Variables are used inside of commands to pull various bits of dynamic information from the bot. An example of an !uptime command could be:

!command add !uptime (channel) has been online for (uptime)

args

return an argument given to the command:

(args [num])

Usage

!command add !shoutout Check out (args 1)'s stream over at http://twitch.tv/(args 1)!

channel

return the channel name:

(channel)

cmd

run a command:

(cmd [command] [args])

Usage

!command add !setpassword (cmd !phrases set password (args 1))Custom games password has been set!
> toovs: !setpassword P455
> Babblerbot: Custom games password has been set!

You can keep contents private by running mod commands from within a discord channel, or from the command line where the bot is being hosted.

countdown

return the time remaining between now and a timestamp:

(countdown [timestamp])

counter

return a stored counter:

(counter [name])

Usage

!command add !wins (channel) has won (counter wins) games today!

counterinc

increase a stored counter by one:

(counterinc [name])

date

return a human-readable version of a stored timestamp:

(date [name])

Usage

!phrases set bday 2019-11-04T00:00-0700
!command add !birthday (channel)'s birthday is on (date bday)

dateinc

increase a stored date by the specified amount:

(dateinc [name] [seconds])

followage

return how long the user has been following the channel:

(followage)

followcount

return the number of channel followers:

(followcount)

fortnite

return the number of fortnite wins:

(fortnite:wins)

return the number of fortnite kills:

(fortnite:kills)

Required Settings

The fortnite:name and fortnite:token settings. The token is obtained from https://fortnitetracker.com/site-api.

Usage

The bot will automatically pull your fortnite stats into these variables, with a delay of a few minutes. By default, they will be reset at the end of every stream. You can also use the stats:reset setting to clear them at a specific hour instead.

phrase

return the stored phrase:

(phrase [name])

Usage

!phrases set password mypass
!command add !customgames the password for custom games is: (phrases password)

pubg

return the number of pubg wins:

(pubg:wins)

return the number of pubg kills:

(pubg:kills)

return the amount of pubg damage dealt:

(pubg:damage)

return the number of pubg headshots:

(pubg:headshots)

return the number of pubg roadkills:

(pubg:roadkills)

return the number of pubg teamkills:

(pubg:teamkills)

return the number of pubg vehicles destroyed:

(pubg:vehicles-destroyed)

Required Settings

The pubg:name and pubg:token settings. The token is obtained from https://developer.pubg.com.

Optional Settings

pubg:platform. By default this is set to “steam”.

Usage

The bot will automatically pull your fortnite stats into these variables, with a delay of a few minutes. By default, they will be reset at the end of every stream. You can also use the stats:reset setting to clear them at a specific hour instead.

spotify

return the title of the currently playing spotify track:

(spotify:playing-title)

return the artist of the currently playing spotify track:

(spotify:playing-artist)

return the album of the currently playing spotify track:

(spotify:playing-album)

Notes

Connect spotify under the integrations tab in the web control panel.

subcount

return the channel’s subscriber count:

(subcount)

time

return the current time in a specific timezone:

(time [zone])

Usage

!command add !localtime It is currently (time America/Chicago) in Chicago.

You can find a list of timezones at https://en.wikipedia.org/wiki/List_of_tz_database_time_zones.

uptime

return the uptime of the current stream:

(uptime)

urlfetch

call a url and return the result:

(urlfetch [url])

Usage

!command add !tweet (urlfetch https://decapi.me/twitter/latest/chocotaco)

user

return the user’s name:

(user)

watchrank

return the user’s watchrank:

(watchrank)

Notes

The viewerstats setting must be set to “true”.

watchtime

return the user’s watchtime:

(watchtime)

Notes

The viewerstats setting must be set to “true”.

youtube

return the url to the latest youtube video:

(youtube:latest-url [id])

return the title of the latest youtube video:

(youtube:latest-url [id])

Notes

The id for https://www.youtube.com/watch?v=qqC-NjCayAA would be "qqC-NjCayAA".