config

package
v0.0.0-...-396f595 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package config handles reading the config data.

Index

Constants

This section is empty.

Variables

View Source
var DefaultNewConfigSource = func() (io.ReadCloser, error) {
	f, err := os.Open(filePath)
	if err != nil {
		return nil, fmt.Errorf("failed to open %q: %w", filePath, err)
	}
	return f, nil
}

DefaultNewConfigSource is the default source of the latest config data.

Functions

This section is empty.

Types

type Config

type Config struct {
	// LogIncoming is whether the bot should log incoming messages.
	LogIncoming bool `toml:"log_incoming_messages"`
	// LogOutgoing is whether the bot should log outgoing messages.
	LogOutgoing bool `toml:"log_outgoing_messages"`
	// Platforms contains platform-specific config data.
	Platforms PlatformConfig
	// SevenTV contains config for talking to the 7TV API.
	SevenTV SevenTVConfig
	// Supinic contains config for talking to the Supinic API.
	Supinic SupinicConfig
}

Config is the top-level config object.

func Read

func Read(r io.Reader) (*Config, error)

Read reads data into a new config.

type KickConfig

type KickConfig struct {
	// JA3 is the ja3 value to use for Kick calls.
	JA3 string
	// UserAgent is the user agent to use for Kick calls.
	UserAgent string `toml:"user_agent"`
}

KickConfig is Kick-specific config data.

type PlatformConfig

type PlatformConfig struct {
	// Kick contains Kick-specific config data.
	Kick KickConfig
	// Twitch contains Twitch-specific config data.
	Twitch TwitchConfig
}

PlatformConfig is platform-specific config data.

type SevenTVConfig

type SevenTVConfig struct {
	// AccessToken is the OAuth2 access token to use for 7TV API calls.
	// It can be obtained by logging in on https://7tv.io/
	// and getting the token from one of the API calls.
	AccessToken string `toml:"access_token"`
}

type SupinicConfig

type SupinicConfig struct {
	// UserID is the Supinic User ID of the bot.
	// https://supinic.com/user/auth-key
	UserID string `toml:"user_id"`
	// APIKey is an authentication key for the bot.
	// https://supinic.com/user/auth-key
	APIKey string `toml:"api_key"`
	// ShouldPingAPI is whether the Supinic API should be pinged from time to time
	// to let the Supinic API know that the bot is alive.
	// Normally, this should only be done by af2bot, the reference instance of Airbot.
	ShouldPingAPI bool `toml:"should_ping_api"`
}

SupinicConfig contains data for talking to the Supinic API.

func (SupinicConfig) IsConfigured

func (s SupinicConfig) IsConfigured() bool

type TwitchConfig

type TwitchConfig struct {
	// Enabled is whether Twitch should be connected to and messages handled.
	Enabled bool
	// Username is the Twitch username of the account to use for the bot.
	Username string
	// ClientID is the Twitch Client ID of the bot.
	// Clients can be created here: https://dev.twitch.tv/console
	ClientID string `toml:"client_id"`
	// ClientSecret is the client secret for the Client ID.
	ClientSecret string `toml:"client_secret"`
	// AccessToken is a **user** OAuth2 token generated by Twitch for the bot account.
	// You can generate one using https://twitchtokengenerator.com
	// See here for more info:
	// https://dev.twitch.tv/docs/irc/authenticate-bot#getting-an-access-token
	AccessToken string `toml:"access_token"`
	// RefreshToken is the refresh token for the access token.
	// It should be provided to you when you generate your token
	// using https://twitchtokengenerator.com
	// See here for more info:
	// https://dev.twitch.tv/docs/authentication/refresh-tokens/
	RefreshToken string `toml:"refresh_token"`
	// Owners contains the Twitch usernames of the bot owner(s).
	Owners []string
}

TwitchConfig is Twitch-specific config data.

Jump to

Keyboard shortcuts

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