twitch-bot

command module
v3.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 97 Imported by: 0

README

Go Report Card

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 see the Wiki for documentation of the configuration file.

# 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' \
        ...
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
apimodules/raffle
Package raffle contains the backend and API implementation as well as the chat listeners for chat-raffles
Package raffle contains the backend and API implementation as well as the chat listeners for chat-raffles
helpers
Package helpers contains helpers to assist in other parts of the code
Package helpers contains helpers to assist in other parts of the code
service/authcache
Package authcache implements a cache for token auth to hold auth- results with cpu/mem inexpensive methods instead of always using secure but expensive methods to validate the token
Package authcache implements a cache for token auth to hold auth- results with cpu/mem inexpensive methods instead of always using secure but expensive methods to validate the token
template/twitch
Package twitch defines Twitch related template functions not having their place in any other package
Package twitch defines Twitch related template functions not having their place in any other package
template/userstate
Package userstate traces the bot state and provides template functions based on it
Package userstate traces the bot state and provides template functions based on it
pkg
database
Package database represents a connector to the sqlite storage backend to store persistent data from core and plugins
Package database represents a connector to the sqlite storage backend to store persistent data from core and plugins

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL