Documentation ¶
Index ¶
- func ByteCount(count int) string
- func ExtractButtonID(update tgbotapi.Update) (int, error)
- func ExtractChatID(update tgbotapi.Update) (int64, error)
- func ExtractPostID(update tgbotapi.Update) (int, error)
- func GetPostTitle(chatName string, postID int) (string, error)
- func MakeDigestPosts(chat *storage.Chat, chatName string) (string, error)
- func MakeDigestUsers(chat *storage.Chat) (string, error)
- func UserStat(user storage.User) (string, error)
- type ButtonHandler
- type Config
- type DigestHandler
- type Handler
- type LikeHandler
- type MessagesConfig
- type PostHandler
- type Telegram
- type TelegramConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractButtonID ¶
ExtractButtonID extract ID of the message with button from callback request
func ExtractChatID ¶
ExtractChatID extracts ID of the chat from which update goes
func ExtractPostID ¶
ExtractPostID extracts ID of the message that button was reply on
func GetPostTitle ¶
GetPostTitle extracts post title for public channel
func MakeDigestPosts ¶
MakeDigestPosts returns text digest about top users for given chat
func MakeDigestUsers ¶
MakeDigestUsers returns text digest about top users for given chat
Types ¶
type ButtonHandler ¶
type ButtonHandler struct {
*Telegram
}
ButtonHandler psorcesses a new post in a group
func (*ButtonHandler) Handle ¶
func (tg *ButtonHandler) Handle(update tgbotapi.Update)
Handle do actions for given Telegram update
type Config ¶
type Config struct { Telegram TelegramConfig Messages MessagesConfig Redis redis.Options }
Config is a container for TOML config content
func ReadConfig ¶
ReadConfig reads TOML config into Config
type DigestHandler ¶
type DigestHandler struct {
*Telegram
}
DigestHandler psorcesses a new post in a group
func (*DigestHandler) Handle ¶
func (tg *DigestHandler) Handle(update tgbotapi.Update)
Handle do actions for given Telegram update
type LikeHandler ¶
type LikeHandler struct {
*Telegram
}
LikeHandler processes "/like" message
func (*LikeHandler) Handle ¶
func (tg *LikeHandler) Handle(update tgbotapi.Update)
Handle do actions for given Telegram update
type MessagesConfig ¶
MessagesConfig is a container for bot messages customization
type PostHandler ¶
type PostHandler struct {
*Telegram
}
PostHandler psorcesses a new post in a group
func (*PostHandler) Handle ¶
func (tg *PostHandler) Handle(update tgbotapi.Update)
Handle do actions for given Telegram update
type Telegram ¶
type Telegram struct {
// contains filtered or unexported fields
}
Telegram is a main logic for handling messages
func NewTelegram ¶
NewTelegram creates Telegram instance
func (*Telegram) RegisterHandler ¶
RegisterHandler adds new Handler for processing of Telegram updates