bots

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: GPL-3.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatBotRunner

type ChatBotRunner interface {
	Run()
	FeedBroadcast(messageChannel <-chan ChatMessage)
}

type ChatMessage

type ChatMessage struct {
	Text   string
	Banner string
}

type TelegramProvider

type TelegramProvider func(token string) (*tgbotapi.BotAPI, error)

type TelegramRunner

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

func NewTelegram

func NewTelegram(token string, cfg config.Config, provider TelegramProvider) (*TelegramRunner, error)

NewTelegram creates a new telegram bot runner. This function uses the `chat_db` environment variable for storing the chats.

func (*TelegramRunner) FeedBroadcast

func (t *TelegramRunner) FeedBroadcast(messageChannel <-chan ChatMessage) error

FeedBroadcast the messages that are passed to each one of the chats.

func (*TelegramRunner) ForEachChat

func (t *TelegramRunner) ForEachChat(callback func(chat interface{}))

ForEachChat goes over all the persisted chats and invokes the callback on them.

func (*TelegramRunner) Run

func (t *TelegramRunner) Run() error

Run the bot, listening for updates from users

Jump to

Keyboard shortcuts

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