Ejemplo n.º 1
0
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())
		}
	})
}
Ejemplo n.º 2
0
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)
		}
	})
}