31 lines
610 B
Go
31 lines
610 B
Go
package tg
|
|
|
|
import (
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
|
)
|
|
|
|
type MessageId int64
|
|
|
|
// Implementing the interface provides
|
|
// way to define what message will be
|
|
// sent to the side of a user.
|
|
type Sendable interface {
|
|
SendConfig(SessionId, *Bot) (SendConfig)
|
|
SetMessage(Message)
|
|
}
|
|
|
|
// The type is used as an endpoint to send messages
|
|
// via bot.Send .
|
|
type SendConfig struct {
|
|
Chattable tgbotapi.Chattable
|
|
Error error
|
|
}
|
|
|
|
|
|
type MessageMap map[string] *Message
|
|
|
|
// Convert to the bot.Api.Send format.
|
|
func (config SendConfig) ToApi() tgbotapi.Chattable {
|
|
return config.Chattable
|
|
}
|
|
|