airbot

command module
v0.0.0-...-9c6474c Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: MIT Imports: 16 Imported by: 0

README

airbot

CodeFactor GoReportCard Go version godoc

High-performance multi-platform utility bot written in Go.

Currently under development.

Support planned for many features (gamba, etc.) and platforms (Twitch, Discord, etc.).

Commands

Commands are available on the commands page.

Live instance

The bot is currently running on the Twitch account af2bot.

It's hosted on an Oracle Cloud arm64 VM.

Add/remove bot

To add the bot to your channel, type $join in af2bot's chat.

To have the bot leave your channel, type $leave in your chat.

Development

Running locally

To run the bot locally:

  1. Install Go
  2. Clone the repository and cd into it
  3. Copy config/config_example.toml to config.toml in the main directory
  4. Fill in the empty fields in config.toml, notably API keys and usernames
  5. Run go run .
Tests

To run tests, run go test ./...

Documentation

Some documentation is generated.

After making changes, run go generate ./... from the main directory to regenerate the docs.

Running in production

To run in production:

  1. Install Go
  2. Clone the repository and cd into it
  3. Run git switch release
  4. Copy config/config_example.toml to config.toml in the main directory
  5. Fill in the empty fields in config.toml, notably API keys and usernames
  6. Reboot the machine
  7. Run go run . to start the bot

Note: It's recommended to run the bot in a tmux or screen session so the bot continues running when you disconnect from the machine.

By default, the SQLite database will be stored in the current directory. To change where the data is stored, set AIRBOT_SQLITE_DATA_DIR, i.e. AIRBOT_SQLITE_DATA_DIR=/some/dir go run .

Maintenance

To update the bot, run git pull, then restart the bot.

Documentation

Overview

Package main contains the main logic for airbot.

Directories

Path Synopsis
apiclients
bible
Package bible provides an API client to the bible-api.com API.
Package bible provides an API client to the bible-api.com API.
bible/bibletest
Package bibletest provides helpers for testing connections to the Bible API.
Package bibletest provides helpers for testing connections to the Bible API.
ivr
Package ivr provides an API client to the ivr.fi API.
Package ivr provides an API client to the ivr.fi API.
ivr/ivrtest
Package ivrtest provides helpers for testing connections to the IVR API.
Package ivrtest provides helpers for testing connections to the IVR API.
kick
Package kick provides an API client to the Kick API.
Package kick provides an API client to the Kick API.
pastebin
Package pastebin handles interactions with the Pastebin API.
Package pastebin handles interactions with the Pastebin API.
pastebin/pastebintest
Package pastebintest provides helpers for testing connections to the Pastebin API.
Package pastebintest provides helpers for testing connections to the Pastebin API.
seventv
Package seventv provides a client to the 7TV API.
Package seventv provides a client to the 7TV API.
seventv/gqltypes
Package gqltypes contains types used in the 7TV GraphQL API.
Package gqltypes contains types used in the 7TV GraphQL API.
seventv/seventvtest
Package seventvtest provides helpers for testing connections to the 7TV API.
Package seventvtest provides helpers for testing connections to the 7TV API.
supinic
Package supinic contains a client for the Supinic API.
Package supinic contains a client for the Supinic API.
supinic/supinictest
Package ivrtest provides helpers for testing connections to the Supinic API.
Package ivrtest provides helpers for testing connections to the Supinic API.
twitchtest
Package provides helpers for testing connections to the Twitch API.
Package provides helpers for testing connections to the Twitch API.
Package base provides base structs used throughout the application.
Package base provides base structs used throughout the application.
arg
Package argument contains command parameter/argument types.
Package argument contains command parameter/argument types.
Package cache provides an interface to a cache.
Package cache provides an interface to a cache.
cachetest
Package cachetest provides a fake cache for testing.
Package cachetest provides a fake cache for testing.
Package commands contains all commands that can be run and a command handler.
Package commands contains all commands that can be run and a command handler.
admin
Package admin handles bot administration commands.
Package admin handles bot administration commands.
basecommand
Package basecommand contains shared types and utilities for command handlers.
Package basecommand contains shared types and utilities for command handlers.
botinfo
Package botinfo implements commands that return info about the bot.
Package botinfo implements commands that return info about the bot.
bulk
Package bulk handles commands that perform bulk operations.
Package bulk handles commands that perform bulk operations.
commandtest
Package commandtest provides helpers for testing commands.
Package commandtest provides helpers for testing commands.
echo
Package echo implements commands that do simple echoes.
Package echo implements commands that do simple echoes.
fun
Package fun implements fun commands that hit APIs.
Package fun implements fun commands that hit APIs.
gamba
Package gamba implements gamba commands.
Package gamba implements gamba commands.
kick
Package kick implements Kick commands.
Package kick implements Kick commands.
moderation
Package moderation implements moderation commands.
Package moderation implements moderation commands.
seventv
Package seventv implements 7TV commands.
Package seventv implements 7TV commands.
twitch
Package twitch implements Twitch commands.
Package twitch implements Twitch commands.
Package config handles reading the config data.
Package config handles reading the config data.
Package database handles connections to the database.
Package database handles connections to the database.
databasetest
Package databasetest provides utilities for database testing.
Package databasetest provides utilities for database testing.
models
Package models defines database data models.
Package models defines database data models.
Documentation generator.
Documentation generator.
Package gamba handles gamba-related things.
Package gamba handles gamba-related things.
Package permission contains permission levels.
Package permission contains permission levels.
Package platforms contains the Platform interface and related.
Package platforms contains the Platform interface and related.
twitch
Package twitch handles Twitch-specific logic.
Package twitch handles Twitch-specific logic.
testing
fakeserver
Package fakeserver provides a fake HTTP server for testing.
Package fakeserver provides a fake HTTP server for testing.
Package utils contains utility functions that don't make sense to have their own namespaced packages.
Package utils contains utility functions that don't make sense to have their own namespaced packages.
cleanup
Package cleanup provides a way to register functions for cleanup and run them.
Package cleanup provides a way to register functions for cleanup and run them.
restart
Package restart provides a way for a command to restart the bot.
Package restart provides a way for a command to restart the bot.

Jump to

Keyboard shortcuts

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