@@ 2,6 2,7 @@ package main
import (
"fmt"
+ "html"
"io/ioutil"
"log"
"strings"
@@ 78,19 79,27 @@ func main() {
Description: fmt.Sprintf("Your color is %s", c.Color),
ThumbURL: fmt.Sprintf("https://dummy.mendel.sh/?width=64&color=%x&color=%x", c.Background, c.Name),
InputMessageContent: tgbotapi.InputTextMessageContent{
- ParseMode: "markdown",
- Text: fmt.Sprintf("Your color is *%s*\n - name: `#%x`\n - background: `#%x`",
- c.Color, c.Name, c.Background),
+ ParseMode: "html",
+ Text: fmt.Sprintf(
+ "Your color is <b>%s</b>\n - name: <code>#%x</code>\n - background: <code>#%x</code>\n<a href=\"%s\">​</a>",
+ c.Color, c.Name, c.Background, html.EscapeString(fmt.Sprintf(
+ "https://dummy.mendel.sh/web/%d/?width=64&color=%x&color=%x",
+ q.From.ID, c.Background, c.Name,
+ )),
+ ),
},
}
results := make([]interface{}, 1)
results[0] = r
- bot.AnswerInlineQuery(tgbotapi.InlineConfig{
+ api, err := bot.AnswerInlineQuery(tgbotapi.InlineConfig{
InlineQueryID: q.ID,
Results: results,
})
+ if err != nil {
+ log.Println(api, err)
+ }
}
}
}