func HelpHandler(message telegram.Message, bot *telegram.Bot, params []string) { helpMsg := `Hey, you can use the following commands: /image <search term> - Send an image /help - Display this message` message.Reply(helpMsg) }
func CurrencyHandler(message telegram.Message, bot *telegram.Bot, params []string) { keyboard := telegram.KeyboardForOptions("Книжка", "НБУ", "RUB") message.ReplyWithKeyboardMarkup("Какой курс?", keyboard) bot.Once(message.From.Id, func(message telegram.Message, bot *telegram.Bot) { if message.Text == "RUB" { message.Reply(fetchRub()) } }) }
func ImageFinder(message telegram.Message, bot *telegram.Bot, params []string) { searchPhrase := strings.Join(params, " ") image, err := google.RandomImage(searchPhrase) if err != nil { message.Reply(err.Error()) return } message.Reply(image) keyboard := telegram.KeyboardForOptions("Yes", "No") message.ReplyWithKeyboardMarkup("Want more?", keyboard) bot.Once(message.From.Id, func(message telegram.Message, bot *telegram.Bot) { if message.Text == "Yes" { ImageFinder(message, bot, params) } }) }
func GoogleSearch(message telegram.Message, bot *telegram.Bot, params []string) { message.Reply("Not implemented") }