Skip to content

Instantly share code, notes, and snippets.

@minya92
Created July 26, 2016 11:39
Show Gist options
  • Save minya92/25d1dff6b2d9e77808b176a412deddc4 to your computer and use it in GitHub Desktop.
Save minya92/25d1dff6b2d9e77808b176a412deddc4 to your computer and use it in GitHub Desktop.
package main
import (
"time"
"github.com/tucnak/telebot"
)
func main() {
bot, err := telebot.NewBot("TOKEN")
if err != nil {
//log.Fatalln(err)
}
messages := make(chan telebot.Message)
bot.Listen(messages, 1*time.Second)
for message := range messages {
if len(message.Text) != 0 {
bot.SendMessage(message.Chat, "Все говорят " + message.Text + ", а ты купи слона xD", &telebot.SendOptions{
ReplyMarkup: telebot.ReplyMarkup{
ForceReply: true,
Selective: true,
ResizeKeyboard: true,
CustomKeyboard: [][]string{
[]string{"Начать игру"},
[]string{"Статистика", "Помощь"},
},
},
},
)
}
if message.Text == "/hi" {
bot.SendMessage(message.Chat,
"Hello, "+message.Sender.FirstName+"!", nil)
}
if message.Text == "/test" {
bot.SendMessage(message.Chat, "pong", &telebot.SendOptions{
ReplyMarkup: telebot.ReplyMarkup{
ForceReply: true,
Selective: true,
CustomKeyboard: [][]string{
[]string{"1", "2", "3"},
[]string{"4", "5", "6"},
[]string{"7", "8", "9"},
[]string{"*", "0", "#"},
},
},
},
)
}
if message.Text == "Начать игру" || message.Text == "/start" {
bot.SendMessage(message.Chat,
"Ты нажал тройку", nil)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment