2023-08-19 12:47:33 +03:00
|
|
|
package tg
|
|
|
|
|
2023-09-08 17:37:32 +03:00
|
|
|
import (
|
|
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MessageId int64
|
2023-08-19 12:47:33 +03:00
|
|
|
|
2023-09-25 23:43:22 +03:00
|
|
|
// Implementing the interface provides
|
|
|
|
// way to define what message will be
|
|
|
|
// sent to the side of a user.
|
2023-09-26 17:13:31 +03:00
|
|
|
type Sendable interface {
|
2024-07-21 16:02:47 +03:00
|
|
|
SendConfig(SessionID, *Bot) (SendConfig)
|
2024-03-29 14:30:48 +03:00
|
|
|
SetMessage(*Message)
|
2023-09-08 17:37:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// The type is used as an endpoint to send messages
|
|
|
|
// via bot.Send .
|
|
|
|
type SendConfig struct {
|
2024-03-28 10:41:09 +03:00
|
|
|
Chattable tgbotapi.Chattable
|
2023-09-16 14:34:17 +03:00
|
|
|
Error error
|
2023-08-19 12:47:33 +03:00
|
|
|
}
|
2023-09-08 17:37:32 +03:00
|
|
|
|
2023-09-16 14:34:17 +03:00
|
|
|
|
|
|
|
type MessageMap map[string] *Message
|
|
|
|
|
2023-09-08 17:37:32 +03:00
|
|
|
// Convert to the bot.Api.Send format.
|
2024-07-21 16:02:47 +03:00
|
|
|
func (config SendConfig) ToAPI() tgbotapi.Chattable {
|
2024-03-28 10:41:09 +03:00
|
|
|
return config.Chattable
|
2023-09-08 17:37:32 +03:00
|
|
|
}
|
|
|
|
|