@@ -583,18 +583,32 @@ func (bot *BotAPI) AnswerInlineQuery(config InlineConfig) (APIResponse, error) {
583583 v := url.Values {}
584584
585585 v .Add ("inline_query_id" , config .InlineQueryID )
586- v .Add ("cache_time" , strconv .Itoa (config .CacheTime ))
587- v .Add ("is_personal" , strconv .FormatBool (config .IsPersonal ))
588- v .Add ("next_offset" , config .NextOffset )
586+ if config .CacheTime > 0 {
587+ v .Add ("cache_time" , strconv .Itoa (config .CacheTime ))
588+ }
589+ if config .IsPersonal {
590+ v .Add ("is_personal" , strconv .FormatBool (config .IsPersonal ))
591+ }
592+ if config .NextOffset != "" {
593+ v .Add ("next_offset" , config .NextOffset )
594+ }
595+
589596 data , err := ffjson .Marshal (config .Results )
590597 if err != nil {
591598 ffjson .Pool (data )
592599 return APIResponse {}, err
593600 }
594601 v .Add ("results" , string (data ))
602+
603+ if config .Button != nil {
604+ if data , err = ffjson .Marshal (config .Button ); err != nil {
605+ ffjson .Pool (data )
606+ return APIResponse {}, err
607+ }
608+ v .Add ("button" , string (data ))
609+ }
610+
595611 ffjson .Pool (data )
596- v .Add ("switch_pm_text" , config .SwitchPMText )
597- v .Add ("switch_pm_parameter" , config .SwitchPMParameter )
598612
599613 bot .debugLog ("answerInlineQuery" , v , nil )
600614
0 commit comments