internal

package
v1.3.5-0...-9ad5f9a Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package mock_internal is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigErrors

type ConfigErrors []validator.FieldError

ConfigErrors lets us wrap the validator errors in a type we can return

func (ConfigErrors) Error

func (ce ConfigErrors) Error() string

type Debug

type Debug struct {
	DebugLevel bool
}

Debug contains information about the debug level

func (Debug) LogDebug

func (d Debug) LogDebug(v ...interface{})

LogDebug prints debug-level messages to standard out

func (Debug) LogError

func (d Debug) LogError(v ...interface{})

LogError prints error-level messages to standard out

func (Debug) LogInfo

func (d Debug) LogInfo(v ...interface{})

LogInfo prints info-level messages to standard out

func (Debug) LogWarning

func (d Debug) LogWarning(v ...interface{})

LogWarning prints warning-level messages to standard out

func (Debug) PrintVersion

func (d Debug) PrintVersion(v ...interface{})

PrintVersion prints the TeleIRC version number

type DebugLogger

type DebugLogger interface {
	LogInfo(v ...interface{})
	LogDebug(v ...interface{})
	LogError(v ...interface{})
	LogWarning(v ...interface{})
	PrintVersion(v ...interface{})
}

DebugLogger provides an interface to call the logging functions

type IRCSettings

type IRCSettings struct {
	BindAddress         string   `env:"IRC_HOST_IP" envDefault:""`
	Server              string   `env:"IRC_SERVER,required"`
	ServerPass          string   `env:"IRC_SERVER_PASSWORD" envDefault:""`
	Port                int      `env:"IRC_PORT" envDefault:"6667" validate:"min=0,max=65535"`
	TLSAllowSelfSigned  bool     `env:"IRC_CERT_ALLOW_SELFSIGNED" envDefault:"true"`
	TLSAllowCertExpired bool     `env:"IRC_CERT_ALLOW_EXPIRED" envDefault:"true"`
	Channel             string   `env:"IRC_CHANNEL,required" validate:"notempty"`
	ChannelKey          string   `env:"IRC_CHANNEL_KEY" envDefault:""`
	BotIdent            string   `env:"IRC_BOT_IDENT,required" envDefault:"teleirc"`
	BotName             string   `env:"IRC_BOT_REALNAME" envDefault:"Powered by TeleIRC <github.com/RITlug/teleirc>"`
	BotNick             string   `env:"IRC_BOT_NAME,required" validate:"notempty"`
	SendStickerEmoji    bool     `env:"IRC_SEND_STICKER_EMOJI" envDefault:"true"`
	SendDocument        bool     `env:"IRC_SEND_DOCUMENT" envDefault:"true"`
	Prefix              string   `env:"IRC_PREFIX" envDefault:"<"`
	Suffix              string   `env:"IRC_SUFFIX" envDefault:">"`
	ShowJoinMessage     bool     `env:"IRC_SHOW_JOIN_MESSAGE" envDefault:"true"`
	ShowLeaveMessage    bool     `env:"IRC_SHOW_LEAVE_MESSAGE" envDefault:"true"`
	ShowZWSP            bool     `env:"IRC_SHOW_ZWSP" envDefault:"true"`
	ShowLocationMessage bool     `env:"IRC_SHOW_LOCATION_MESSAGE" envDefault:"false"`
	NickServUser        string   `env:"IRC_NICKSERV_USER" envDefault:""`
	NickServPassword    string   `env:"IRC_NICKSERV_PASS" envDefault:""`
	NickServService     string   `env:"IRC_NICKSERV_SERVICE" envDefault:""`
	EditedPrefix        string   `env:"IRC_EDITED_PREFIX" envDefault:"[EDIT] "`
	MaxMessageLength    int      `env:"IRC_MAX_MESSAGE_LENGTH" envDefault:"400"`
	IRCBlacklist        []string `env:"IRC_BLACKLIST" envDefault:"[]string{}"`
	UseSSL              bool     `env:"IRC_USE_SSL" envDefault:"false"`
	NoForwardPrefix     string   `env:"IRC_NO_FORWARD_PREFIX" envDefault:""`
	QuitMessage         string   `env:"IRC_QUIT_MESSAGE" envDefault:""`
}

IRCSettings includes settings related to the IRC bot/message relaying

type ImgurSettings

type ImgurSettings struct {
	ImgurClientID     string `env:"IMGUR_CLIENT_ID" envDefault:"7d6b00b87043f58"`
	ImgurClientSecret string `env:"IMGUR_CLIENT_SECRET" envDefault:""`
	ImgurRefreshToken string `env:"IMGUR_REFRESH_TOKEN" envDefault:""`
	ImgurAccessToken  string ``
	ImgurAlbumHash    string `env:"IMGUR_ALBUM_HASH" envDefault:""`
}

ImgurSettings includes settings related to Imgur uploading for Telegram photos

type MockDebugLogger

type MockDebugLogger struct {
	// contains filtered or unexported fields
}

MockDebugLogger is a mock of DebugLogger interface

func NewMockDebugLogger

func NewMockDebugLogger(ctrl *gomock.Controller) *MockDebugLogger

NewMockDebugLogger creates a new mock instance

func (*MockDebugLogger) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDebugLogger) LogDebug

func (m *MockDebugLogger) LogDebug(v ...interface{})

LogDebug mocks base method

func (*MockDebugLogger) LogError

func (m *MockDebugLogger) LogError(v ...interface{})

LogError mocks base method

func (*MockDebugLogger) LogInfo

func (m *MockDebugLogger) LogInfo(v ...interface{})

LogInfo mocks base method

func (*MockDebugLogger) LogWarning

func (m *MockDebugLogger) LogWarning(v ...interface{})

LogWarning mocks base method

func (*MockDebugLogger) PrintVersion

func (m *MockDebugLogger) PrintVersion(v ...interface{})

PrintVersion mocks base method

type MockDebugLoggerMockRecorder

type MockDebugLoggerMockRecorder struct {
	// contains filtered or unexported fields
}

MockDebugLoggerMockRecorder is the mock recorder for MockDebugLogger

func (*MockDebugLoggerMockRecorder) LogDebug

func (mr *MockDebugLoggerMockRecorder) LogDebug(v ...interface{}) *gomock.Call

LogDebug indicates an expected call of LogDebug

func (*MockDebugLoggerMockRecorder) LogError

func (mr *MockDebugLoggerMockRecorder) LogError(v ...interface{}) *gomock.Call

LogError indicates an expected call of LogError

func (*MockDebugLoggerMockRecorder) LogInfo

func (mr *MockDebugLoggerMockRecorder) LogInfo(v ...interface{}) *gomock.Call

LogInfo indicates an expected call of LogInfo

func (*MockDebugLoggerMockRecorder) LogWarning

func (mr *MockDebugLoggerMockRecorder) LogWarning(v ...interface{}) *gomock.Call

LogWarning indicates an expected call of LogWarning

func (*MockDebugLoggerMockRecorder) PrintVersion

func (mr *MockDebugLoggerMockRecorder) PrintVersion(v ...interface{}) *gomock.Call

PrintVersion indicates an expected call of PrintVersion

type Settings

type Settings struct {
	IRC      IRCSettings
	Telegram TelegramSettings
	Imgur    ImgurSettings
}

Settings includes all user-configurable settings for TeleIRC

func LoadConfig

func LoadConfig(path string) (*Settings, error)

LoadConfig loads in the .env file in the provided path (or ".env" by default) If the user-provided config is valid, return a new Settings struct that contains these settings. Otherwise, return the error that caused the failure.

type TelegramSettings

type TelegramSettings struct {
	Token                 string   `env:"TELEIRC_TOKEN,required"`
	ChatID                int64    `env:"TELEGRAM_CHAT_ID,required"`
	Prefix                string   `env:"TELEGRAM_MESSAGE_PREFIX" envDefault:"<"`
	Suffix                string   `env:"TELEGRAM_MESSAGE_SUFFIX" envDefault:">"`
	ReplyPrefix           string   `env:"TELEGRAM_MESSAGE_REPLY_PREFIX" envDefault:"["`
	ReplySuffix           string   `env:"TELEGRAM_MESSAGE_REPLY_SUFFIX" envDefault:"]"`
	ReplyLength           int      `env:"TELEGRAM_MESSAGE_REPLY_LENGTH" envDefault:"15"`
	ShowTopicMessage      bool     `env:"SHOW_TOPIC_MESSAGE" envDefault:"false"`
	ShowJoinMessage       bool     `env:"SHOW_JOIN_MESSAGE" envDefault:"false"`
	JoinMessageAllowList  []string `env:"JOIN_MESSAGE_ALLOW_LIST" envDefault:"[]string{}"`
	ShowActionMessage     bool     `env:"SHOW_ACTION_MESSAGE" envDefault:"true"`
	ShowLeaveMessage      bool     `env:"SHOW_LEAVE_MESSAGE" envDefault:"false"`
	LeaveMessageAllowList []string `env:"LEAVE_MESSAGE_ALLOW_LIST" envDefault:"[]string{}"`
	ShowKickMessage       bool     `env:"SHOW_KICK_MESSAGE" envDefault:"false"`
	ShowNickMessage       bool     `env:"SHOW_NICK_MESSAGE" envDefault:"false"`
	ShowDisconnectMessage bool     `env:"SHOW_DISCONNECT_MESSAGE" envDefault:"false"`
	MaxMessagePerMinute   int      `env:"MAX_MESSAGE_PER_MINUTE" envDefault:"20"`
}

TelegramSettings includes settings related to the Telegram bot/message relaying

Directories

Path Synopsis
handlers
irc
telegram
Package telegram handles all Telegram-side logic.
Package telegram handles all Telegram-side logic.

Jump to

Keyboard shortcuts

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