Documentation ¶
Index ¶
- type Client
- func (c Client) AddHandler(eventType string, cb func(*girc.Client, girc.Event))
- func (c Client) Close()
- func (c Client) ConnectDialer(dialer girc.Dialer) error
- func (c Client) IRCSettings() *internal.IRCSettings
- func (c Client) Join(channels ...string)
- func (c Client) JoinKey(channel string, key string)
- func (c Client) Logger() internal.DebugLogger
- func (c Client) Message(channel string, msg string)
- func (c Client) SendMessage(msg string)
- func (c Client) SendToTg(msg string)
- func (c Client) StartBot(errChan chan<- error, sendMessage func(string))
- func (c Client) TgSettings() *internal.TelegramSettings
- type ClientInterface
- type Handler
- type MockClientInterface
- func (m *MockClientInterface) AddHandler(arg0 string, arg1 func(*girc.Client, girc.Event))
- func (m *MockClientInterface) ConnectDialer(arg0 girc.Dialer) error
- func (m *MockClientInterface) EXPECT() *MockClientInterfaceMockRecorder
- func (m *MockClientInterface) IRCSettings() *internal.IRCSettings
- func (m *MockClientInterface) Join(arg0 ...string)
- func (m *MockClientInterface) JoinKey(arg0, arg1 string)
- func (m *MockClientInterface) Logger() internal.DebugLogger
- func (m *MockClientInterface) Message(arg0, arg1 string)
- func (m *MockClientInterface) SendMessage(arg0 string)
- func (m *MockClientInterface) SendToTg(arg0 string)
- func (m *MockClientInterface) StartBot(arg0 chan<- error, arg1 func(string))
- func (m *MockClientInterface) TgSettings() *internal.TelegramSettings
- type MockClientInterfaceMockRecorder
- func (mr *MockClientInterfaceMockRecorder) AddHandler(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) ConnectDialer(arg0 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) IRCSettings() *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) Join(arg0 ...interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) JoinKey(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) Logger() *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) Message(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) SendMessage(arg0 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) SendToTg(arg0 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) StartBot(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockClientInterfaceMockRecorder) TgSettings() *gomock.Call
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 ¶
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 ¶
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 ¶
Join attempts to enter a list of IRC channels, at bulk if possible to prevent sending extensive JOIN commands.
func (Client) Logger ¶
func (c Client) Logger() internal.DebugLogger
Logger returns the DebugLogger to be used for logging
func (Client) SendMessage ¶
SendMessage sends a message to the IRC channel specified in the settings
func (Client) StartBot ¶
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 ¶
AddHandler mocks base method
func (*MockClientInterface) ConnectDialer ¶
func (m *MockClientInterface) ConnectDialer(arg0 girc.Dialer) error
ConnectDialer mocks base method
func (*MockClientInterface) EXPECT ¶
func (m *MockClientInterface) EXPECT() *MockClientInterfaceMockRecorder
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 ¶
func (m *MockClientInterface) Logger() internal.DebugLogger
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 ¶
func (m *MockClientInterface) TgSettings() *internal.TelegramSettings
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 ¶
func (mr *MockClientInterfaceMockRecorder) Logger() *gomock.Call
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