The bot is currently in alpha, that means not all features are here, but it is possible to run. Expect large changes to still occur.
Desbot is a streaming bot for Twitch, it runs as a browser-source in your streaming software, it can connect to various APIs and services, play back media and show on screen graphics.
The bot is meant to be a nexus for your stream interactions, it can connect to a range of services and APIs, and it can be extended with custom scripts. Expand the section below for a high level overview of what it can do.
- Create, manage and listen for Twitch rewards, toggle them on/off depending on a range of conditions, update their settings.
- Listen to commands from Twitch chat, write to Twitch chat and act on whispers.
- Post messages and embeds in Discord channels via webhooks.
- Speak text using Google TTS, read out chat, reward messages, status messages, announcements, support for users to change their own voice.
- Comes with a lot of support functions like name cleanup, text cleanup, custom nicks, word to audio replacement, a dictionary for word replacement.
- Connect to a range of accessory tools: to change SteamVR settings, capture SteamVR screenshots, detect running SteamVR games, send overlays into SteamVR, and more.
- Connect to OBS Studio using the 4.x Websocket plugin, to show/hide sources and filters, trigger screenshot capture.
- Write text labels to disk, as well modify a range of settings for various functions in the system.
- Send key presses to arbitrary applications using PHP to execute an AutoIT v3 component.
- Can pipe screenshots from both SteamVR and OBS to overlays and/or Discord.
- Can trigger custom URIs for applications, or load a URL in the background to trigger standard webhooks.
- Load and post Steam game info & achievements to Twitch chat & Discord.
- Update the Twitch category from the currently running Steam game automatically.
This section will explain how to get started with the bot, how to install it, how to configure it, and how to use it. Expand the sections below as you go.
- You need to have at least one user account on Twitch as that is needed to get through the setup, two is recommended though to avoid complications.
- A webserver with PHP 8.2 or higher, an easy ready-made solution is XAMPP.
- Inside
php.ini
inxampp/php
uncomment this line:extension=sqlite3
by removing the leading;
to enable the SQLite3 plugin. Then restart Apache.
- Inside
- To compile TypeScript you need Node.JS.
- A secondary Twitch account to use as a bot in chat, so it doesn't look like you are writing all automated messages yourself.
- Git installed, possibly with a GUI client, so you can clone the repository and easily pull down new changes, it is also used to name backup archives when using the included backup script.
- Make sure you can access it in your terminal, run
git version
in the terminal and see if it succeeds, if not it needs to be added to thePATH
environmental variable.
- Make sure you can access it in your terminal, run
- An API key from Google, so you get access to TTS functionality, which is a commonly used feature in the bot.
- Clone this repository to a folder in the document root of your webserver, go to it in the terminal and run
git clone https://github.com/BOLL7708/desbot.git
. If you are usingXAMPP
the root isxampp/htdocs
. - Navigate into the
./scripts
folder and run1_install.cmd
, this will install dependencies and compile the project. - Open the URL to the bot in your browser and go through the setup, see the next section for configuration, the URL should look something like this if you used the defaults:
http://localhost/desbot/
- You should be seeing the initial setup, which includes signing in with Twitch for both your channel and a second account to act as a bot in chat.
- After the setup you have access to the main interface, here it is recommended to go to the
🍰 Defaults
section to import default presets and events, this will help you get a very solid base setup and includes things that are not documented yet. - Go to
🎨 Config > Speech > Google Api Key
, and insert your API key if you have one, this to get TTS throughout. - Use the
🧰 Tools
section of the editor to perform things like importing existing Twitch rewards, load data for Twitch users, load data for Steam games, connect to a Philips Hue hub, and more.- If you have existing rewards on Twitch, it is a good idea to use the import tools in here. Keep in mind that if you want the bot to be able to update and toggle your rewards, they need to be created by the bot. You can still import existing rewards, delete them on Twitch, and then have this bot recreate them from the imported presets.
Updating is simple now, just open a terminal in the project and:
- Navigate to the
./scripts
folder. - Run the
2_update.cmd
script.
This should pull down updates using git and rebuild the project. Reloading the editor should show a new version number under the logo in the top left corner.
Links to various tools and resources.
- XAMPP - Used to run the bot locally, as the backend is currently relying on PHP.
- Git - Used to clone the repository and to check which commit the project is on to name backups.
- Node.JS - Used to compile TypeScript to JavaScript.
- Open Broadcaster Software - Streaming software, used to run the bot as a browser source.
- AutoIT v3 - Used to send key presses to arbitrary applications.
- DB Browser for SQLite - SQLite database browser, useful for inspecting the database.
- OpenVR2WS - Used to connect to SteamVR to leech data from it and remotely change settings.
- OpenVROverlayPipe - Used to launch overlay graphics and notifications in SteamVR.
- SuperScreenShotterVR - Used to capture screenshots from SteamVR and pipe them to overlays and/or Discord.
Information about how the application is build and functions, as well as future plans.
This describes the various data structure that is used to manage and configure the bot.
There are a range of data sources used by the events, triggers and actions. These are descibed below.
flowchart LR
Desbot[DESBOT\nThe bot uses these things to function.]
Desbot --> Config[CONFIG\nCollections of configuration\nvalues used for various integrations.]
Desbot --> Preset[PRESET\nManually added data that is meant\nto be reused in multiple places.]
Desbot --> Setting[SETTING\nAutomatically added data that the bot\nmanages, usually no need to access these.]
Desbot --> Event[EVENT\nContains triggers\nthat trigger actions.]
Event --> Trigger[TRIGGER\nThese are the things that\ncauses the bot to perform things.]
Event --> Action[ACTION\nThese are the things that\nthe bot can cause to happen.]
Events are the main way to configure the bot to act on specific triggers to perform a range of actions. The root element is as mentioned the event, then you assign the triggers and actions to it, and the constitutes the entire thing.
The items below are both major conversions and new features. These are things that are going to happen at some point, most things are already sketched out and planned.
- The DB conversion took 16 months, but it's done, it's on here as there is some polish to do before continuing to the next thing.
- Convert the backend of the project to Node.JS, this has a number of benefits.
- NPM libraries for Twitch, Discord, etc. This will offload the API integration maintenance which will help a lot.
- Node instead of Apache for HTTP serving, this will remove one installation to run the bot.
- Node instead of PHP for page rendering and DB access, this will make for a more stable connection to SQLite.
- Node to host a Websocket relay server, instead of relying on a separate application.
- Node can run some browser APIs that can be offloaded from the browser component.
- Node can be run on Windows, Mac, Linux and can thus likely run 24/7 on a Raspberry Pi.
- Presenter - Break out the presentation part into a separate component. This will come automatically with the Node.JS conversion, but could be looked at beforehand. Basically all media playback and on screen overlays will be a separately hosted webpage that gets data over Websockets from the backend.
- Dashboard - Create a Stream Deck equivalent as a webpage, where reward and system features can be toggled or triggered. This is where the old game reward profile feature will come back as we can persist reward states for the running Steam game.
This has been the plan for a while, the whole conversion from config files to database with an editor has taken a while, so we're still a bit from splitting up the project and convert it to Node.JS.
flowchart LR
Desbot[DESBOT]
Desbot --> Nexus[NEXUS\nThe backend running in Node.JS\nmanaging data I/O and API\nconnections. Will host web\ncomponents and a websocket relay.]
Nexus --> Presenter[PRESENTER\nWeb component that displays\ngraphics, video and plays back audio.\nUsed as browser source in OBS.]
Nexus --> Editor[EDITOR\nWeb component that provides\nsetup and configuration.]
Nexus --> Dashboard[DASHBOARD\nWeb component that provides\na Stream Deck equivalent\nfor managing the system.]