Self-hosted alternative to one of the big bots managed by big companies…
Find a file
Knut Ahlers d8ab2b0ff6
Improve sidenav display
by marking active item bold and using nested routes

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2024-08-27 00:23:55 +02:00
.github/workflows CI: Disable SSL on mysql test container 2024-06-09 13:25:06 +02:00
ci Implement dashboard content 2024-08-27 00:23:54 +02:00
docs [templating] Add streamIsLive function 2024-05-26 15:50:10 +02:00
editor gootstrap new layout 2024-08-27 00:23:54 +02:00
internal Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
pkg Lint: Update linter config 2024-06-09 13:01:32 +02:00
plugins Lint: Update linter config 2024-06-09 13:01:32 +02:00
src Improve sidenav display 2024-08-27 00:23:55 +02:00
.dockerignore [editor] Rework to use esbuild / Vue component files (#12) 2021-12-06 17:25:19 +01:00
.eslintrc.js Hook botauth against events 2024-08-27 00:23:55 +02:00
.gitattributes [docs] Move documentation from Wiki to docs-site (#49) 2023-08-14 15:44:23 +02:00
.gitignore Improve interactions 2024-08-27 00:23:54 +02:00
.gitmodules [docs] Move documentation from Wiki to docs-site (#49) 2023-08-14 15:44:23 +02:00
.golangci.yml Lint: Update linter config 2024-06-09 13:01:32 +02:00
action_script.go [core] Enforce field validation on config 2024-04-08 17:40:24 +02:00
actions.go [core] Add locking to prevent concurrent rule executions 2024-05-01 22:39:18 +02:00
actorDocs.go prepare release v3.0.0 2022-11-02 22:54:52 +01:00
actorDocs.tpl [docs] Allow to comment default value for actor docs 2023-08-14 16:04:03 +02:00
auth.go Lint: Update linter config, improve code quality 2024-01-01 17:52:39 +01:00
authBackends.go Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
authMiddleware.go Add new editor token generator 2024-08-27 00:23:54 +02:00
automessage.go [core] Switch to go_helpers FieldCollection 2024-04-07 13:37:13 +02:00
botEditor.go Add channel editing interface 2024-08-27 00:23:55 +02:00
chatcommands.go [core] Update go-irc to v4.0.0 2023-09-11 19:51:38 +02:00
cli.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_actorDocs.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_apiToken.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_migrateDatabase.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_resetSecrets.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_tplDocs.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
cli_validateConfig.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
config.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
config_test.go [#16] Implement Raffle module (#47) 2023-07-14 16:15:58 +02:00
configEditor.go Lint: Resolve linter issues 2024-02-18 13:42:00 +01:00
configEditor_automessage.go Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
configEditor_dev.go [editor] Rework to use esbuild / Vue component files (#12) 2021-12-06 17:25:19 +01:00
configEditor_general.go Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
configEditor_global.go Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
configEditor_prod.go [editor] Rework to use esbuild / Vue component files (#12) 2021-12-06 17:25:19 +01:00
configEditor_rules.go Allow to issue generic tokens with variable expiry 2024-08-27 00:23:55 +02:00
configRemoteUpdate.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
configwatch.go Fix: Do not spam events when file is gone for longer 2021-05-24 18:00:50 +02:00
cors.go [core] Fix: Allow PATCH method in CORS 2022-03-29 00:56:10 +02:00
default_config.yaml Breaking: Add configuration interface and switch to more generic config format (#7) 2021-09-22 15:36:45 +02:00
Dockerfile [CI] Add Docker-Publish pipeline 2024-03-04 00:13:37 +01:00
events.go [eventsub] Add support for suspicious user events 2024-04-07 13:37:13 +02:00
fields.go Expose user_id in events 2022-06-17 22:13:47 +02:00
functions.go Update dependencies 2024-04-26 19:34:35 +02:00
functions_irc.go [core] Switch to go_helpers FieldCollection 2024-04-07 13:37:13 +02:00
functions_test.go Lint: Fix linter errors 2023-03-24 22:32:00 +01:00
git.go Lint: Update linter config, improve code quality 2024-01-01 17:52:39 +01:00
go.mod Add new editor token generator 2024-08-27 00:23:54 +02:00
go.sum Add new editor token generator 2024-08-27 00:23:54 +02:00
helpers.go [core] Move storage to SQLite database (#30) 2022-09-10 13:39:07 +02:00
History.md prepare release v3.33.1 2024-08-14 16:23:51 +02:00
hooker.go [#16] Implement Raffle module (#47) 2023-07-14 16:15:58 +02:00
irc.go Lint: Update linter config 2024-06-09 13:01:32 +02:00
LICENSE Add META 2020-12-21 01:55:48 +01:00
main.go Disable authentication with Twitch token 2024-08-27 00:23:54 +02:00
main_test.go [ci] Add integration tests for database servers 2023-08-26 22:40:17 +02:00
Makefile CI: Fix bugs in new CI flow 2024-04-13 13:55:54 +02:00
msgformatter.go [core] Switch to go_helpers FieldCollection 2024-04-07 13:37:13 +02:00
package-lock.json Implement dashboard content 2024-08-27 00:23:54 +02:00
package.json Implement dashboard content 2024-08-27 00:23:54 +02:00
plugins.go Lint: Resolve linter issues 2024-02-18 13:42:00 +01:00
plugins_core.go [core] Switch to go_helpers FieldCollection 2024-04-07 13:37:13 +02:00
plugins_unsupported.go Add plugin support to allow extending of functionality (#6) 2021-08-19 15:33:56 +02:00
README.md Cleanup README 2024-02-18 14:17:30 +01:00
scopes.go [eventsub] Add support for suspicious user events 2024-04-07 13:37:13 +02:00
status.go Lint: Fix error caused by stupid linter 2024-04-02 16:12:35 +02:00
swagger.go Lint: Fix linter errors 2023-03-24 22:32:00 +01:00
swagger.html [openapi] Allow subdir serving 2021-10-10 01:40:44 +02:00
tplDocs.go [core] Switch to go_helpers FieldCollection 2024-04-07 13:37:13 +02:00
tplDocs.tpl [core] Remove v2 migration 2023-08-26 00:20:10 +02:00
tplDocs_test.go [docs] Add auto-generated template documentation (#50) 2023-08-25 23:37:37 +02:00
tsconfig.json Add TS config and I18n 2024-08-27 00:23:54 +02:00
twitchWatcher.go [eventsub] Suspicious user topics were moved from beta to v1 2024-04-13 17:29:14 +02:00
wrNoOpCloser.go Add raw-log functionality 2021-04-09 18:14:44 +02:00

Luzifer / twitch-bot

Twitch-Bot is intended as an alternative to having a bot managed by Streamlabs or Streamelements and therefore having more control over it, the availability and how it works.

At the moment it is a work-in-progress and does not yet implment all features it shall in the future.

Configuration

Please refer to the Documentation how to setup and configure the bot.

# twitch-bot --help
Usage of twitch-bot:
      --base-url string                  External URL of the config-editor interface (used to generate auth-urls)
      --command-timeout duration         Timeout for command execution (default 30s)
  -c, --config string                    Location of configuration file (default "./config.yaml")
      --log-level string                 Log level (debug, info, warn, error, fatal) (default "info")
      --plugin-dir string                Where to find and load plugins (default "/usr/lib/twitch-bot")
      --rate-limit duration              How often to send a message (default: 20/30s=1500ms, if your bot is mod everywhere: 100/30s=300ms, different for known/verified bots) (default 1.5s)
      --sentry-dsn string                Sentry / GlitchTip DSN for error reporting
      --storage-conn-string string       Connection string for the database (default "./storage.db")
      --storage-conn-type string         One of: mysql, postgres, sqlite (default "sqlite")
      --storage-encryption-pass string   Passphrase to encrypt secrets inside storage (defaults to twitch-client:twitch-client-secret)
      --twitch-client string             Client ID to act as
      --twitch-client-secret string      Secret for the Client ID
      --twitch-token string              OAuth token valid for client (fallback if no token was set in interface)
  -v, --validate-config                  Loads the config, logs any errors and quits with status 0 on success
      --version                          Prints current version and exits
      --wait-for-selfcheck duration      Maximum time to wait for the self-check to respond when behind load-balancers (default 1m0s)

# twitch-bot help
Supported sub-commands are:
  actor-docs                                        Generate markdown documentation for available actors
  api-token <token-name> <scope> [...scope]         Generate an api-token to be entered into the config
  copy-database <target storage-type> <target DSN>  Copies database contents to a new storage DSN i.e. for migrating to a new DBMS
  reset-secrets                                     Remove encrypted data to reset encryption passphrase
  tpl-docs                                          Generate markdown documentation for available template functions
  validate-config                                   Try to load configuration file and report errors if any

Database Connection Strings

Currently these databases are supported and need their corresponding connection strings:

MySQL

[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]

Recommended parameters:
  ?charset=utf8mb4&parseTime=True&loc=Local
  • Create your database as follows:
    CREATE DATABASE twbot_tezrian DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_unicode_ci;
    
  • Start your bot:
    # twitch-bot \
        --storage-conn-type mysql \
        --storage-conn-string 'tezrian:mypass@tcp(mariadb:3306)/twbot_tezrian?charset=utf8mb4&parseTime=True&loc=Local' \
        ...
    

See driver documentation for more details on parameters.

Postgres

host=localhost port=5432 dbname=mydb connect_timeout=10

See Postgres documentation for more details in paramters.

SQLite

storage.db

Just pass the filename you want to use.

  • Start your bot:
    # twitch-bot \
        --storage-conn-type sqlite \
        --storage-conn-string 'storage.db' \
        ...