twitch-bot

command module
v3.24.1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2024 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
actors/announce
Package announce contains a chat essage handler to create announcements from the bot
Package announce contains a chat essage handler to create announcements from the bot
actors/ban
Package ban contains actors to ban/unban users in a channel
Package ban contains actors to ban/unban users in a channel
actors/clip
Package clip contains an actor to create clips on behalf of a channels owner
Package clip contains an actor to create clips on behalf of a channels owner
actors/clipdetector
Package clipdetector contains an actor to detect clip links in a message and populate a template variable
Package clipdetector contains an actor to detect clip links in a message and populate a template variable
actors/commercial
Package commercial contains an actor to run commercials in a channel
Package commercial contains an actor to run commercials in a channel
actors/counter
Package counter contains actors and template functions to work with database stored counters
Package counter contains actors and template functions to work with database stored counters
actors/delay
Package delay contains an actor to delay rule execution
Package delay contains an actor to delay rule execution
actors/delete
Package deleteactor contains an actor to delete messages
Package deleteactor contains an actor to delete messages
actors/eventmod
Package eventmod contains an actor to modify event data during rule execution by adding fields (template variables)
Package eventmod contains an actor to modify event data during rule execution by adding fields (template variables)
actors/filesay
Package filesay contains an actor to paste a remote URL as chat commands i.e.
Package filesay contains an actor to paste a remote URL as chat commands i.e.
actors/linkdetector
Package linkdetector contains an actor to detect links in a message and add them to a variable
Package linkdetector contains an actor to detect links in a message and add them to a variable
actors/linkprotect
Package linkprotect contains an actor to prevent chatters from posting certain links
Package linkprotect contains an actor to prevent chatters from posting certain links
actors/log
Package log contains an actor to write bot-log entries from a rule
Package log contains an actor to write bot-log entries from a rule
actors/messagehook
Package messagehook contains actors to send discord / slack webhook requests
Package messagehook contains actors to send discord / slack webhook requests
actors/modchannel
Package modchannel contains an actor to modify title / category of a channel
Package modchannel contains an actor to modify title / category of a channel
actors/nuke
Package nuke contains a hateraid protection actor recording messages in all channels for a certain period of time being able to "nuke" their authors by regular expression based on past messages
Package nuke contains a hateraid protection actor recording messages in all channels for a certain period of time being able to "nuke" their authors by regular expression based on past messages
actors/punish
Package punish contains an actor to punish behaviour in a channel with rising punishments
Package punish contains an actor to punish behaviour in a channel with rising punishments
actors/quotedb
Package quotedb contains a quote database and actor / api methods to manage it
Package quotedb contains a quote database and actor / api methods to manage it
actors/raw
Package raw contains an actor to send raw IRC messages
Package raw contains an actor to send raw IRC messages
actors/respond
Package respond contains an actor to send a message
Package respond contains an actor to send a message
actors/shield
Package shield contains an actor to update the shield-mode for a given channel
Package shield contains an actor to update the shield-mode for a given channel
actors/shoutout
Package shoutout contains an actor to create a Twitch native shoutout
Package shoutout contains an actor to create a Twitch native shoutout
actors/stopexec
Package stopexec contains an actor to stop the rule execution on template condition
Package stopexec contains an actor to stop the rule execution on template condition
actors/timeout
Package timeout contains an actor to timeout users
Package timeout contains an actor to timeout users
actors/variables
Package variables contains an actor and database client to store handle variables
Package variables contains an actor and database client to store handle variables
actors/vip
Package vip contains actors to modify VIPs of a channel
Package vip contains actors to modify VIPs of a channel
actors/whisper
Package whisper contains an actor to send whispers
Package whisper contains an actor to send whispers
apimodules/customevent
Package customevent contains an actor and database modules to create custom (timed) events
Package customevent contains an actor and database modules to create custom (timed) events
apimodules/msgformat
Package msgformat contains an API route to utilize the internal message formatter to format strings
Package msgformat contains an API route to utilize the internal message formatter to format strings
apimodules/overlays
Package overlays contains a server to host overlays and interact with the bot using sockets and a pre-defined Javascript client
Package overlays contains a server to host overlays and interact with the bot using sockets and a pre-defined Javascript client
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
linkcheck
Package linkcheck implements a helper library to search for links in a message text and validate them by trying to call them
Package linkcheck implements a helper library to search for links in a message text and validate them by trying to call them
service/access
Package access contains a service to manage Twitch tokens and scopes
Package access contains a service to manage Twitch tokens and scopes
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
service/timer
Package timer contains a service to store and manage timers in a database
Package timer contains a service to store and manage timers in a database
template/api
Package api contains helpers to interact with remote APIs in templates
Package api contains helpers to interact with remote APIs in templates
template/numeric
Package numeric contains helpers for numeric manipulation
Package numeric contains helpers for numeric manipulation
template/random
Package random contains helpers to aid with randomness
Package random contains helpers to aid with randomness
template/slice
Package slice contains slice manipulation helpers
Package slice contains slice manipulation helpers
template/strings
Package strings contains string manipulation helpers
Package strings contains string manipulation helpers
template/subscriber
Package subscriber contains template functions to fetch sub-count and -points
Package subscriber contains template functions to fetch sub-count and -points
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
twitch
Package twitch implements a client for the Twitch APIs
Package twitch implements a client for the Twitch APIs
Package plugins defines interfaces and helpers for plugin (internal and external ones) development and integration
Package plugins defines interfaces and helpers for plugin (internal and external ones) development and integration

Jump to

Keyboard shortcuts

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