all repos — telegram-bot-api @ 13f31854a28f71ceeca124692f59679a937440f1

Golang bindings for the Telegram Bot API

Clean up some formatting.
Syfaro syfaro@foxpaw.in
Thu, 02 Jun 2016 15:57:39 -0500
commit

13f31854a28f71ceeca124692f59679a937440f1

parent

7f37376fd009c882bfa6145859de839327ec0cfa

2 files changed, 2 insertions(+), 70 deletions(-)

jump to
M bot_test.gobot_test.go

@@ -516,71 +516,3 @@ log.Println(err)

} } } - -func ExampleAnswerInlineQueryMarkdown() { - bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken") // create new bot - if err != nil { - log.Panic(err) - } - - log.Printf("Authorized on account %s", bot.Self.UserName) - - u := tgbotapi.NewUpdate(0) - u.Timeout = 60 - - updates, err := bot.GetUpdatesChan(u) - - for update := range updates { - if update.InlineQuery == nil { // if no inline query, ignore it - continue - } - - article := tgbotapi.NewInlineQueryResultArticleMarkdown(update.InlineQuery.ID, "Echo", update.InlineQuery.Query) - article.Description = update.InlineQuery.Query - - inlineConf := tgbotapi.InlineConfig{ - InlineQueryID: update.InlineQuery.ID, - IsPersonal: true, - CacheTime: 0, - Results: []interface{}{article}, - } - - if _, err := bot.AnswerInlineQuery(inlineConf); err != nil { - log.Println(err) - } - } -} - -func ExampleAnswerInlineQueryHTML() { - bot, err := tgbotapi.NewBotAPI("MyAwesomeBotToken") // create new bot - if err != nil { - log.Panic(err) - } - - log.Printf("Authorized on account %s", bot.Self.UserName) - - u := tgbotapi.NewUpdate(0) - u.Timeout = 60 - - updates, err := bot.GetUpdatesChan(u) - - for update := range updates { - if update.InlineQuery == nil { // if no inline query, ignore it - continue - } - - article := tgbotapi.NewInlineQueryResultArticleHTML(update.InlineQuery.ID, "Echo", update.InlineQuery.Query) - article.Description = update.InlineQuery.Query - - inlineConf := tgbotapi.InlineConfig{ - InlineQueryID: update.InlineQuery.ID, - IsPersonal: true, - CacheTime: 0, - Results: []interface{}{article}, - } - - if _, err := bot.AnswerInlineQuery(inlineConf); err != nil { - log.Println(err) - } - } -}
M helpers.gohelpers.go

@@ -335,7 +335,7 @@ Type: "article",

ID: id, Title: title, InputMessageContent: InputTextMessageContent{ - Text: messageText, + Text: messageText, ParseMode: "Markdown", }, }

@@ -348,7 +348,7 @@ Type: "article",

ID: id, Title: title, InputMessageContent: InputTextMessageContent{ - Text: messageText, + Text: messageText, ParseMode: "HTML", }, }