send.go 611 B

12345678910111213141516171819202122232425262728293031
  1. package tg
  2. import (
  3. tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
  4. )
  5. type MessageId int64
  6. // Implementing the interface provides
  7. // way to define what message will be
  8. // sent to the side of a user.
  9. type Sendable interface {
  10. SendConfig(SessionID, *Bot) (SendConfig)
  11. SetMessage(*Message)
  12. }
  13. // The type is used as an endpoint to send messages
  14. // via bot.Send .
  15. type SendConfig struct {
  16. Chattable tgbotapi.Chattable
  17. Error error
  18. }
  19. type MessageMap map[string] *Message
  20. // Convert to the bot.Api.Send format.
  21. func (config SendConfig) ToAPI() tgbotapi.Chattable {
  22. return config.Chattable
  23. }