configuration

package
v0.0.0-...-19ad383 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conf

type Conf struct {
	// Conf
	ConfigFile string
	// contains filtered or unexported fields
}

Conf is a struct representing a server configuration

func New

func New() *Conf

New returns a new object representing our program configuration

func (*Conf) AddClientMod

func (c *Conf) AddClientMod(id int64) error

AddClientMod adds an allowed mod to the config file and saves said config

func (*Conf) AddCmndAuth

func (c *Conf) AddCmndAuth(cmnd string, l int)

AddCmndAuth sets the authorization level required for a given command

func (*Conf) AddRoleAuth

func (c *Conf) AddRoleAuth(rID string, l int) error

AddRoleAuth sets the role to have a given command authorization level

func (*Conf) AddServerMod

func (c *Conf) AddServerMod(id int64) error

AddServerMod adds a server mod to the config file and saves said config

func (*Conf) BotsAllowed

func (c *Conf) BotsAllowed() bool

BotsAllowed returns whether or not bots are permitted to issue commands to this

bot

func (*Conf) BuildModConfig

func (c *Conf) BuildModConfig() error

BuildModConfig generates a valid modconfig.lua file for Avorion

func (*Conf) ChatChannel

func (c *Conf) ChatChannel() string

ChatChannel returns the current chat channel ID string

func (*Conf) ChatPipe

func (c *Conf) ChatPipe() chan ifaces.ChatData

ChatPipe returns a go channel for chat piping

func (*Conf) CommandAliases

func (c *Conf) CommandAliases(cmd string) (bool, []string)

CommandAliases - Return a slice with the current aliases for a command.

@cmd string    Command with aliases that will be returned

func (*Conf) CommandDisabled

func (c *Conf) CommandDisabled(cmd string) bool

CommandDisabled - Check if a given command is disabled

@cmd string    Command to be checked

func (*Conf) DBName

func (c *Conf) DBName() string

DBName returns a string containing the filename of the DB that we are using

func (*Conf) DBUpdateTimeDuration

func (c *Conf) DBUpdateTimeDuration() time.Duration

DBUpdateTimeDuration returns a time.Duration based on the configured seconds until between dbupdates

func (*Conf) DataPath

func (c *Conf) DataPath() string

DataPath returns the current datapath for Avorion

func (*Conf) DisableCommand

func (c *Conf) DisableCommand(s string) error

DisableCommand - Disable a command if it isn't already disabled.

@s string    Command to be disabled
func (c *Conf) DiscordLink() string

DiscordLink returns a link to a Discord server

func (*Conf) Galaxy

func (c *Conf) Galaxy() string

Galaxy returns the current Galaxyname for Avorion

func (*Conf) GameConfig

func (c *Conf) GameConfig() (*ifaces.ServerGameConfig, bool)

GameConfig returns the loaded server.ini object

func (*Conf) GetAliasedCommand

func (c *Conf) GetAliasedCommand(s string) (bool, string)

GetAliasedCommand - Locate a command that has the given string as an alias.

@s string    Alias to be checked

func (*Conf) GetCmndAuth

func (c *Conf) GetCmndAuth(cmnd string) int

GetCmndAuth gets the roles that are authorized to run the given command

func (*Conf) GetEvents

func (c *Conf) GetEvents() []*ifaces.LoggedServerEvent

GetEvents returns the current list of LoggedServerEvents

func (*Conf) GetRoleAuth

func (c *Conf) GetRoleAuth(rID string) int

GetRoleAuth gets the integer authorization level of a role

func (*Conf) HangTimeDuration

func (c *Conf) HangTimeDuration() time.Duration

HangTimeDuration returns a time.Duration based on the configured seconds until between hang checks

func (*Conf) InstallPath

func (c *Conf) InstallPath() string

InstallPath returns the current installation path for Avorion

func (*Conf) ListClientMods

func (c *Conf) ListClientMods() []int64

ListClientMods returns a slice of all of the Workshop mods configured to be allowed for clients

func (*Conf) ListServerMods

func (c *Conf) ListServerMods() []int64

ListServerMods returns a slice of all of the Workshop mods configured to be installed

func (*Conf) LoadConfiguration

func (c *Conf) LoadConfiguration() error

LoadConfiguration loads the given configuration file

func (*Conf) LoadGameConfig

func (c *Conf) LoadGameConfig() error

LoadGameConfig loads the server.ini file from the current game path

func (*Conf) LogChannel

func (c *Conf) LogChannel() string

LogChannel returns the current chat channel ID string

func (*Conf) LogPipe

func (c *Conf) LogPipe() chan ifaces.ChatData

LogPipe returns a go channel for chat piping

func (*Conf) Loglevel

func (c *Conf) Loglevel() int

Loglevel - Return the objects name

func (*Conf) PostDownCommand

func (c *Conf) PostDownCommand() string

PostDownCommand returns the command configured to be run when taking down the server normally

func (*Conf) PostUpCommand

func (c *Conf) PostUpCommand() string

PostUpCommand returns the command configured to be run when starting the server

func (*Conf) Prefix

func (c *Conf) Prefix() string

Prefix returns the current prefix

func (*Conf) RCONAddr

func (c *Conf) RCONAddr() string

RCONAddr returns the current RCON address

func (*Conf) RCONBin

func (c *Conf) RCONBin() string

RCONBin returns the current RCON binary in use TODO: This is temporary, until the rconlib is implemented

func (*Conf) RCONPass

func (c *Conf) RCONPass() string

RCONPass returns the current RCON password

func (*Conf) RCONPort

func (c *Conf) RCONPort() int

RCONPort returns the current RCON port

func (*Conf) ReactConfirm

func (c *Conf) ReactConfirm() bool

ReactConfirm returns a bool that determines whether or not to react to a chat message that was transferred.

func (*Conf) RemoveClientMod

func (c *Conf) RemoveClientMod(id int64) error

RemoveClientMod removes an allowed mod to the config file and saves said config

func (*Conf) RemoveCmndAuth

func (c *Conf) RemoveCmndAuth(cmnd string) error

RemoveCmndAuth removes a commands authorization requirements

func (*Conf) RemoveRoleAuth

func (c *Conf) RemoveRoleAuth(rID string) error

RemoveRoleAuth removes authorization for a role

func (*Conf) RemoveServerMod

func (c *Conf) RemoveServerMod(id int64) error

RemoveServerMod removes a server mod to the config file and saves said config

func (*Conf) SaveConfiguration

func (c *Conf) SaveConfiguration() error

SaveConfiguration saves our current configuration to a yaml file

func (*Conf) SetAliasCommand

func (c *Conf) SetAliasCommand(r string, a string) error

SetAliasCommand - Alias a command if the alias has net yet been set.

@r string    Comand to be aliased
@a string    Alias to be configured

func (*Conf) SetBotsAllowed

func (c *Conf) SetBotsAllowed(allowed bool)

SetBotsAllowed sets BotsAllowed

func (*Conf) SetChatChannel

func (c *Conf) SetChatChannel(id string) chan ifaces.ChatData

SetChatChannel sets the channel that ifaces chat is output to

@id string		Channel ID to set
func (c *Conf) SetDiscordLink(link string)

SetDiscordLink sets a link to a Discord server

func (*Conf) SetGalaxy

func (c *Conf) SetGalaxy(name string)

SetGalaxy returns the current Galaxyname for Avorion

func (*Conf) SetLogChannel

func (c *Conf) SetLogChannel(id string) chan ifaces.ChatData

SetLogChannel sets the channel that ifaces chat is output to

@id string		Channel ID to set

func (*Conf) SetLoglevel

func (c *Conf) SetLoglevel(l int)

SetLoglevel - Return the objects name

func (*Conf) SetPrefix

func (c *Conf) SetPrefix(prefix string)

SetPrefix sets the current bot prefix

TODO perform the checks for the prefix configuration *here* rather than in
the *discord.Bot object

func (*Conf) SetStatusChannel

func (c *Conf) SetStatusChannel(id string)

SetStatusChannel sets the current status channel

func (*Conf) SetTimeZone

func (c *Conf) SetTimeZone(tz string) error

SetTimeZone -

func (*Conf) SetToken

func (c *Conf) SetToken(t string)

SetToken sets the current Token

func (*Conf) StatusChannel

func (c *Conf) StatusChannel() (string, bool)

StatusChannel returns the current status channel

func (*Conf) StatusChannelClear

func (c *Conf) StatusChannelClear() bool

StatusChannelClear returns whether or not the bot should clear

our server status channel before posting

func (*Conf) TimeZone

func (c *Conf) TimeZone() string

TimeZone -

func (*Conf) Token

func (c *Conf) Token() string

Token returns the current Token

func (*Conf) UUID

func (c *Conf) UUID() string

UUID - Return the objects name

func (*Conf) Validate

func (c *Conf) Validate() error

Validate confirms that the configuration object in its current state is a working configuration

Jump to

Keyboard shortcuts

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