stop.go 583 B

123456789101112131415161718192021
  1. package handler
  2. import (
  3. tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
  4. log "gogs.veloe.link/toomanysugar/GoEthemineTelegramBot/internal/logger"
  5. )
  6. func (ah ActionHandler) StopHandler(chatId int64, params []string) []tgbotapi.MessageConfig {
  7. if len(params) != 0 {
  8. return []tgbotapi.MessageConfig{tgbotapi.NewMessage(chatId, "usage: /stop")}
  9. }
  10. text, err := ah.dbconn.DeleteUser(chatId)
  11. if err != nil {
  12. log.LogError.Println(err)
  13. text = "Internal error, please contact bot developer"
  14. }
  15. return []tgbotapi.MessageConfig{
  16. tgbotapi.NewMessage(chatId, text)}
  17. }