bot

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Irc *hbot.Bot
	DB  *sql.DB
}

Bot is the basic bot with a state storage and a database connection.

func NewBot

func NewBot(config *Configuration) (*Bot, error)

NewBot returns a new bot instance

type Configuration

type Configuration struct {
	// Name of the server you're connecting to
	ServerName string `json:"server"`
	// Server TCP port
	ServerPort uint `json:"port"`
	// set to true if you want to connect via TLS
	UseTLS bool `json:"use_tls"`
	// Set to true to use SASL auth
	UseSASL bool `json:"use_sasl"`
	// Nickname
	NickName string `json:"nick"`
	// NickServ password for the given nickname
	Password string `json:"password"`
	// Array of chat channels to join
	Channels []string `json:"channels"`
	// Which of these channels are considered public (so a reduced amount of data)
	// will be reported.
	PublicChannels []string `json:"public_channels"`
	// DSN of the database connection.
	DbDsn string `json:"db_dsn"`
	// The nicknames of the admins of the bot.
	// You should take care of ensure their nicknames are
	// protected
	Admins []string `json:"admins"`
}

Configuration holds all the configuration of the bot

func GetConfig

func GetConfig(fileName string) (*Configuration, error)

GetConfig initializes a configuration object from reading a properly formatted json file

func (*Configuration) GetServerString

func (c *Configuration) GetServerString() string

GetServerString gives you a host:port string of the server to connect to.

func (*Configuration) IsPublicChannel

func (c *Configuration) IsPublicChannel(channel string) bool

IsPublicChannel tells you if a channel is public or not.

Jump to

Keyboard shortcuts

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