Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Sources []string EmailFrom string EmailHost string EmailPort int EmailLogin string EmailPassword string TelegramToken string VkToken string }
Config is the configuration object.
type ContactsConverter ¶
type ContactsConverter interface {
Convert(contact ContactsGetter) map[string]string
}
ContactsConverter is the interface for converting contacts to map.
type ContactsGetter ¶
ContactsGetter is the interface for contacts.
type ContactsMapper ¶
type ContactsMapper struct{}
ContactsMapper maps contacts to the sources.
func NewContactsConverter ¶
func NewContactsConverter() *ContactsMapper
NewContactsConverter creates a new contacts mapper.
func (*ContactsMapper) Convert ¶
func (c *ContactsMapper) Convert(contact ContactsGetter) map[string]string
Convert converts contacts to map.
type EmailDialer ¶
type EmailDialer interface {
DialAndSend(m ...*gomail.Message) error
}
Dialer is the interface for dialing.
type EmailSender ¶
type EmailSender struct {
// contains filtered or unexported fields
}
EmailSender is a email sender.
func NewEmailSender ¶
func NewEmailSender(config *Config) *EmailSender
NewEmailSender creates a new email sender.
func (*EmailSender) Send ¶
func (s *EmailSender) Send(id string, message MessageGetter, ch chan error)
Send sends a message.
type Logger ¶
type Logger interface { Error(args ...interface{}) Infof(format string, args ...interface{}) }
Logger logs errors.
type MessageGetter ¶
MessageGetter is the interface for messages.
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger is the struct to send messages via different sources to contact.
func NewMessenger ¶
NewMessenger creates a new messenger.
func (*Messenger) Send ¶
func (s *Messenger) Send( contact ContactsGetter, message MessageGetter, sources ...string, )
Send the message to the contact.
type Sender ¶
type Sender interface {
Send(id string, message MessageGetter, ch chan error)
}
Sender is the interface for sending messages.
type SenderFactory ¶
type SenderFactory struct{}
SenderFactory is a factory to create senders.
func NewSenderFactory ¶
func NewSenderFactory() *SenderFactory
NewSenderFactory creates a new sender factory.
type TelegramBotSender ¶
TelegramBotSender is the interface for sending telegram messages.
type TelegramSender ¶
type TelegramSender struct {
// contains filtered or unexported fields
}
TelegramSender is a telegram sender.
func NewTelegramSender ¶
func NewTelegramSender(config *Config) *TelegramSender
NewTelegramSender creates a new telegram sender.
func (*TelegramSender) Send ¶
func (s *TelegramSender) Send(id string, message MessageGetter, ch chan error)
Send sends a message to the channel.