@@ -516,3 +516,71 @@ func ExampleAnswerInlineQuery() {
516516 }
517517 }
518518}
519+
520+ func ExampleAnswerInlineQueryMarkdown () {
521+ bot , err := tgbotapi .NewBotAPI ("MyAwesomeBotToken" ) // create new bot
522+ if err != nil {
523+ log .Panic (err )
524+ }
525+
526+ log .Printf ("Authorized on account %s" , bot .Self .UserName )
527+
528+ u := tgbotapi .NewUpdate (0 )
529+ u .Timeout = 60
530+
531+ updates , err := bot .GetUpdatesChan (u )
532+
533+ for update := range updates {
534+ if update .InlineQuery == nil { // if no inline query, ignore it
535+ continue
536+ }
537+
538+ article := tgbotapi .NewInlineQueryResultArticleMarkdown (update .InlineQuery .ID , "Echo" , update .InlineQuery .Query )
539+ article .Description = update .InlineQuery .Query
540+
541+ inlineConf := tgbotapi.InlineConfig {
542+ InlineQueryID : update .InlineQuery .ID ,
543+ IsPersonal : true ,
544+ CacheTime : 0 ,
545+ Results : []interface {}{article },
546+ }
547+
548+ if _ , err := bot .AnswerInlineQuery (inlineConf ); err != nil {
549+ log .Println (err )
550+ }
551+ }
552+ }
553+
554+ func ExampleAnswerInlineQueryHTML () {
555+ bot , err := tgbotapi .NewBotAPI ("MyAwesomeBotToken" ) // create new bot
556+ if err != nil {
557+ log .Panic (err )
558+ }
559+
560+ log .Printf ("Authorized on account %s" , bot .Self .UserName )
561+
562+ u := tgbotapi .NewUpdate (0 )
563+ u .Timeout = 60
564+
565+ updates , err := bot .GetUpdatesChan (u )
566+
567+ for update := range updates {
568+ if update .InlineQuery == nil { // if no inline query, ignore it
569+ continue
570+ }
571+
572+ article := tgbotapi .NewInlineQueryResultArticleHTML (update .InlineQuery .ID , "Echo" , update .InlineQuery .Query )
573+ article .Description = update .InlineQuery .Query
574+
575+ inlineConf := tgbotapi.InlineConfig {
576+ InlineQueryID : update .InlineQuery .ID ,
577+ IsPersonal : true ,
578+ CacheTime : 0 ,
579+ Results : []interface {}{article },
580+ }
581+
582+ if _ , err := bot .AnswerInlineQuery (inlineConf ); err != nil {
583+ log .Println (err )
584+ }
585+ }
586+ }
0 commit comments