Пример #1
0
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)
}
Пример #2
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())
		}
	})
}
Пример #3
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)
		}
	})
}
Пример #4
0
func GoogleSearch(message telegram.Message, bot *telegram.Bot, params []string) {
	message.Reply("Not implemented")
}