2018-02-20 15:34:50 +00:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
2018-06-24 17:37:20 +00:00
|
|
|
"gitlab.com/toby3d/mypackbot/internal/bot"
|
|
|
|
"gitlab.com/toby3d/mypackbot/internal/db"
|
|
|
|
"gitlab.com/toby3d/mypackbot/internal/errors"
|
|
|
|
"gitlab.com/toby3d/mypackbot/internal/i18n"
|
|
|
|
"gitlab.com/toby3d/mypackbot/internal/models"
|
|
|
|
"gitlab.com/toby3d/mypackbot/internal/utils"
|
|
|
|
tg "gitlab.com/toby3d/telegram"
|
2018-02-20 15:34:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Help just send instructions about bot usage
|
|
|
|
func Help(msg *tg.Message) {
|
2018-06-24 20:11:47 +00:00
|
|
|
t, err := i18n.SwitchTo(msg.From.LanguageCode)
|
2018-02-20 15:34:50 +00:00
|
|
|
errors.Check(err)
|
|
|
|
|
2018-04-19 15:16:17 +00:00
|
|
|
err = db.DB.ChangeUserState(msg.From, models.StateNone)
|
2018-02-20 15:34:50 +00:00
|
|
|
errors.Check(err)
|
|
|
|
|
|
|
|
_, err = bot.Bot.SendChatAction(msg.Chat.ID, tg.ActionTyping)
|
|
|
|
errors.Check(err)
|
|
|
|
|
|
|
|
reply := tg.NewMessage(
|
2018-06-24 20:11:47 +00:00
|
|
|
msg.Chat.ID, t("reply_help", map[string]interface{}{
|
2018-02-20 15:34:50 +00:00
|
|
|
"AddStickerCommand": models.CommandAddSticker,
|
|
|
|
"AddPackCommand": models.CommandAddPack,
|
|
|
|
"DeleteStickerCommand": models.CommandDeleteSticker,
|
|
|
|
"DeletePackCommand": models.CommandDeletePack,
|
|
|
|
"ResetCommand": models.CommandReset,
|
|
|
|
"CancelCommand": models.CommandCancel,
|
2018-04-19 15:16:17 +00:00
|
|
|
"Username": bot.Bot.Username,
|
2018-02-20 15:34:50 +00:00
|
|
|
}),
|
|
|
|
)
|
2018-06-24 17:37:20 +00:00
|
|
|
reply.ParseMode = tg.StyleMarkdown
|
2018-06-24 20:11:47 +00:00
|
|
|
reply.ReplyMarkup = utils.MenuKeyboard(t)
|
2018-02-20 15:34:50 +00:00
|
|
|
|
|
|
|
_, err = bot.Bot.SendMessage(reply)
|
|
|
|
errors.Check(err)
|
|
|
|
}
|