types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVariableConfigPath = "CONFIG_PATH"

	AppName = "hephaestus"

	CmdHelp    = "help"
	CmdConnect = "connect"
	CmdDocs    = "docs"
	CmdSend    = "send"
	CmdVerify  = "verify"
	CmdCheck   = "check"

	LogCommand       = "command"
	LogUser          = "user"
	LogExpirationEnd = "expiration_end"
	LogRecipient     = "recipient"

	NetworkTestnet = "testnet"
	NetworkMainnet = "mainnet"

	ReactionOK      = "✅"
	ReactionWarning = "🚨"
)

Variables

View Source
var (
	HomeDir, _ = os.UserHomeDir()
	DataDir    = path.Join(HomeDir, ".hephaestus")
)

Functions

This section is empty.

Types

type BotConfig

type BotConfig struct {
	Token       string              `yaml:"token"`
	Prefix      string              `yaml:"prefix"`
	Limitations []*LimitationConfig `yaml:"limitations"`
}

BotConfig contains the configuration about the bot

func (*BotConfig) FindLimitationByCommand

func (cfg *BotConfig) FindLimitationByCommand(command string) *LimitationConfig

type ChainConfig

type ChainConfig struct {
	*wallettypes.ChainConfig `yaml:"-,inline"`
	ChainGraphQL             string `yaml:"chain_graphql_addr"`
	DesmosGraphQL            string `yaml:"djuno_graphql_addr"`
}

ChainConfig wraps the wallet ChainConfig structure adding the GraphQL endpoint

type CmdHandler

type CmdHandler = func(s disgord.Session, h *disgord.MessageCreate) error

CmdHandler represents a function that extends a disgord.HandlerMessageCreate to allow it to return an error

func MergeHandlers

func MergeHandlers(handlers ...CmdHandler) CmdHandler

MergeHandlers merges all the given handlers into a single one

type Config

type Config struct {
	Networks  *NetworksConfig `yaml:"networks"`
	BotConfig *BotConfig      `yaml:"bot"`
}

Config contains all the configuration data

func Parse

func Parse(filePath string) (*Config, error)

Parse allows to parse the file at the provided path into a Config object

type DiscordConfig

type DiscordConfig struct {
	VerifiedUserRole      uint64 `yaml:"verified_user_role_id"`
	VerifiedValidatorRole uint64 `yaml:"verified_validator_role_id"`
}

DiscordConfig contains the configuration about the Discord server

type Error

type Error struct {
	Description string
	Reaction    string
}

Error represents a generic Hephaestus error

func New

func New(description, reaction string) *Error

New allows to build a new Error instance

func NewTimeErr

func NewTimeErr(description string) *Error

func NewWarnErr

func NewWarnErr(description string, args ...interface{}) *Error

func (*Error) Error

func (e *Error) Error() string

Error implements err.Error

type LimitationConfig

type LimitationConfig struct {
	Command  string        `yaml:"command"`
	Duration time.Duration `yaml:"duration"`
}

type NetworkConfig

type NetworkConfig struct {
	Chain   *ChainConfig               `yaml:"chain"`
	Account *wallettypes.AccountConfig `yaml:"account"`
	Themis  *ThemisConfig              `yaml:"themis"`
	Discord *DiscordConfig             `yaml:"discord"`
}

NetworkConfig contains the configuration about the Desmos network to be used

type NetworksConfig

type NetworksConfig struct {
	Testnet *NetworkConfig `yaml:"testnet"`
	Mainnet *NetworkConfig `yaml:"mainnet"`
}

type ThemisConfig

type ThemisConfig struct {
	// Themis host URL to where to upload data
	Host string `yaml:"host"`

	// Path to the PKCS#8-encoded private key of the bot
	PrivateKeyPath string `yaml:"private_key_path"`
}

ThemisConfig contains the configuration of the Themis APIs endpoint

Jump to

Keyboard shortcuts

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