Archived
1
This repository has been archived on 2022-11-04. You can view files and clone it, but cannot push or open issues or pull requests.
i2_bot/lib/pokedexer/cleaners.go

33 lines
690 B
Go
Raw Normal View History

2017-12-04 23:14:41 +04:00
// i2_bot Instinct PokememBro Bot
// Copyright (c) 2017 Vladimir "fat0troll" Hodakov
package pokedexer
import (
"github.com/go-telegram-bot-api/telegram-bot-api"
"strconv"
)
// DeletePokememe deletes pokememe by its ID
func (p *Pokedexer) DeletePokememe(update *tgbotapi.Update) string {
pokememeNum, _ := strconv.Atoi(update.Message.CommandArguments())
if pokememeNum == 0 {
return "fail"
}
err := c.DataCache.DeletePokememeByID(pokememeNum)
2017-12-04 23:14:41 +04:00
if err != nil {
c.Log.Error(err.Error())
return "fail"
}
message := "Покемем удалён."
msg := tgbotapi.NewMessage(update.Message.Chat.ID, message)
msg.ParseMode = "Markdown"
c.Bot.Send(msg)
return "ok"
}