irc

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*girc.Client
	Settings         *internal.IRCSettings
	TelegramSettings *internal.TelegramSettings
	// contains filtered or unexported fields
}

Client contains information for our IRC bridge, including the girc Client and the IRCSettings that were passed into NewClient

func NewClient

func NewClient(settings *internal.IRCSettings, telegramSettings *internal.TelegramSettings, logger internal.DebugLogger) Client

NewClient returns a new IRCClient based on the provided settings

func (Client) AddHandler

func (c Client) AddHandler(eventType string, cb func(*girc.Client, girc.Event))

AddHandler registers the handler function for the given event.

func (Client) Close

func (c Client) Close()

Close disconnects from the IRC channel. If a quit message was specified, it gets sent first. Some servers may not report the QUIT message unless the bot was in the channel for a minimum amount of time.

func (Client) ConnectDialer

func (c Client) ConnectDialer(dialer girc.Dialer) error

ConnectDialer allows you to specify your own custom dialer which implements the Dialer interface.

func (Client) IRCSettings

func (c Client) IRCSettings() *internal.IRCSettings

IRCSettings returns the IRCSettings struct associated with this client

func (Client) Join

func (c Client) Join(channels ...string)

Join attempts to enter a list of IRC channels, at bulk if possible to prevent sending extensive JOIN commands.

func (Client) JoinKey

func (c Client) JoinKey(channel string, key string)

JoinKey attempts to enter an IRC channel with a password.

func (Client) Logger

func (c Client) Logger() internal.DebugLogger

Logger returns the DebugLogger to be used for logging

func (Client) Message

func (c Client) Message(channel string, msg string)

Message sends a PRIVMSG to target (either channel, service, or user).

func (Client) SendMessage

func (c Client) SendMessage(msg string)

SendMessage sends a message to the IRC channel specified in the settings

func (Client) SendToTg

func (c Client) SendToTg(msg string)

SendToTg sends a message to Telegram

func (Client) StartBot

func (c Client) StartBot(errChan chan<- error, sendMessage func(string))

StartBot adds necessary handlers to the client and then connects, returns any errors that occur

func (Client) TgSettings

func (c Client) TgSettings() *internal.TelegramSettings

TgSettings returns the TgSettings struct associated with this client

type ClientInterface

type ClientInterface interface {
	SendMessage(string)
	StartBot(chan<- error, func(string))
	Logger() internal.DebugLogger

	SendToTg(string)
	IRCSettings() *internal.IRCSettings
	TgSettings() *internal.TelegramSettings

	AddHandler(string, func(*girc.Client, girc.Event))
	ConnectDialer(girc.Dialer) error
	Message(string, string)
	JoinKey(string, string)
	Join(...string)
	// contains filtered or unexported methods
}

ClientInterface represents an IRC client

type Handler

type Handler = func(c ClientInterface) func(*girc.Client, girc.Event)

Handler specifies a function that handles an IRC event In this case, we take an IRC client and return a function that handles an IRC event

type MockClientInterface

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

MockClientInterface is a mock of ClientInterface interface

func NewMockClientInterface

func NewMockClientInterface(ctrl *gomock.Controller) *MockClientInterface

NewMockClientInterface creates a new mock instance

func (*MockClientInterface) AddHandler

func (m *MockClientInterface) AddHandler(arg0 string, arg1 func(*girc.Client, girc.Event))

AddHandler mocks base method

func (*MockClientInterface) ConnectDialer

func (m *MockClientInterface) ConnectDialer(arg0 girc.Dialer) error

ConnectDialer mocks base method

func (*MockClientInterface) EXPECT

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

func (*MockClientInterface) IRCSettings

func (m *MockClientInterface) IRCSettings() *internal.IRCSettings

IRCSettings mocks base method

func (*MockClientInterface) Join

func (m *MockClientInterface) Join(arg0 ...string)

Join mocks base method

func (*MockClientInterface) JoinKey

func (m *MockClientInterface) JoinKey(arg0, arg1 string)

JoinKey mocks base method

func (*MockClientInterface) Logger

Logger mocks base method

func (*MockClientInterface) Message

func (m *MockClientInterface) Message(arg0, arg1 string)

Message mocks base method

func (*MockClientInterface) SendMessage

func (m *MockClientInterface) SendMessage(arg0 string)

SendMessage mocks base method

func (*MockClientInterface) SendToTg

func (m *MockClientInterface) SendToTg(arg0 string)

SendToTg mocks base method

func (*MockClientInterface) StartBot

func (m *MockClientInterface) StartBot(arg0 chan<- error, arg1 func(string))

StartBot mocks base method

func (*MockClientInterface) TgSettings

TgSettings mocks base method

type MockClientInterfaceMockRecorder

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

MockClientInterfaceMockRecorder is the mock recorder for MockClientInterface

func (*MockClientInterfaceMockRecorder) AddHandler

func (mr *MockClientInterfaceMockRecorder) AddHandler(arg0, arg1 interface{}) *gomock.Call

AddHandler indicates an expected call of AddHandler

func (*MockClientInterfaceMockRecorder) ConnectDialer

func (mr *MockClientInterfaceMockRecorder) ConnectDialer(arg0 interface{}) *gomock.Call

ConnectDialer indicates an expected call of ConnectDialer

func (*MockClientInterfaceMockRecorder) IRCSettings

func (mr *MockClientInterfaceMockRecorder) IRCSettings() *gomock.Call

IRCSettings indicates an expected call of IRCSettings

func (*MockClientInterfaceMockRecorder) Join

func (mr *MockClientInterfaceMockRecorder) Join(arg0 ...interface{}) *gomock.Call

Join indicates an expected call of Join

func (*MockClientInterfaceMockRecorder) JoinKey

func (mr *MockClientInterfaceMockRecorder) JoinKey(arg0, arg1 interface{}) *gomock.Call

JoinKey indicates an expected call of JoinKey

func (*MockClientInterfaceMockRecorder) Logger

Logger indicates an expected call of Logger

func (*MockClientInterfaceMockRecorder) Message

func (mr *MockClientInterfaceMockRecorder) Message(arg0, arg1 interface{}) *gomock.Call

Message indicates an expected call of Message

func (*MockClientInterfaceMockRecorder) SendMessage

func (mr *MockClientInterfaceMockRecorder) SendMessage(arg0 interface{}) *gomock.Call

SendMessage indicates an expected call of SendMessage

func (*MockClientInterfaceMockRecorder) SendToTg

func (mr *MockClientInterfaceMockRecorder) SendToTg(arg0 interface{}) *gomock.Call

SendToTg indicates an expected call of SendToTg

func (*MockClientInterfaceMockRecorder) StartBot

func (mr *MockClientInterfaceMockRecorder) StartBot(arg0, arg1 interface{}) *gomock.Call

StartBot indicates an expected call of StartBot

func (*MockClientInterfaceMockRecorder) TgSettings

func (mr *MockClientInterfaceMockRecorder) TgSettings() *gomock.Call

TgSettings indicates an expected call of TgSettings

Jump to

Keyboard shortcuts

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