Documentation ¶
Index ¶
Constants ¶
const ( BotAPITokenEnvName = "TELEGRAM_BOT_API_TOKEN" UpdatesTimeout = 60 )
const ( DeviceStorePath = "db/whatsapp.db" DeviceNotLinkedMessage = "Device is not linked yet. Please go to WhatsApp -> Settings -> Linked Devices and scan the QR code" )
Variables ¶
var (
ErrNoTokenSpecified = errors.New("no bot API token available (please set the TELEGRAM_BOT_API_TOKEN environment variable)")
)
Functions ¶
This section is empty.
Types ¶
type Messenger ¶
type Messenger interface { OnMessage(func(sender string, recipient string, isGroup bool, message string)) SendMessage(recipient string, message string) error Disconnect() }
func CreateMessenger ¶
func CreateMessenger(clientType MessengerClientType) (Messenger, error)
type MessengerClientType ¶
type MessengerClientType int64
const ( WhatsApp MessengerClientType = iota Telegram )
type TelegramMessenger ¶
type TelegramMessenger struct {
// contains filtered or unexported fields
}
TelegramMessenger uses the Telegram Bot API to send and receive Telegram messages. To obtain a bot token follow the instructions at https://core.telegram.org/bots/tutorial#obtain-your-bot-token.
By default your bot can be added to any group. If you want to disable this use /setjoingroups Also by default, in group chats, your bot will only receive messages that either start with a / (bot command) or mention your bot's username. This can be disabled (making it receive all messages) by using /setprivacy.
func NewTelegramMessenger ¶
func NewTelegramMessenger() (*TelegramMessenger, error)
func (*TelegramMessenger) Disconnect ¶
func (messenger *TelegramMessenger) Disconnect()
func (*TelegramMessenger) SendMessage ¶
func (messenger *TelegramMessenger) SendMessage(recipient string, message string) error
type WhatsAppMessenger ¶
type WhatsAppMessenger struct {
// contains filtered or unexported fields
}
WhatsAppMessenger uses the whatsmeow package to create a client that allows sending and receiving of messages through WhatsApp. The multi-device functionality of WhatsApp is used to talk to the API.
func NewWhatsAppMessenger ¶
func NewWhatsAppMessenger() (*WhatsAppMessenger, error)
func (*WhatsAppMessenger) Disconnect ¶
func (messenger *WhatsAppMessenger) Disconnect()
func (*WhatsAppMessenger) SendMessage ¶
func (messenger *WhatsAppMessenger) SendMessage(recipient string, message string) error