package handler import ( "gitea.neur0tx.site/Neur0toxine/vegapokerbot/internal/handler/iface" "github.com/mymmrac/telego" tu "github.com/mymmrac/telego/telegoutil" ) // kaomojis contains a list of some hand-picked kaomojis. // // Initially I wanted to make inline search feature for Redmine integration, but I realized that I don't have any data // about target chat in the inline webhook. Ergo, I can't really say which Redmine integration to pick in case user // is registered and added more than one chat. Also, other chat members won't be able to use the feature since they // are not registered in the chat and Telegram doesn't allow us to get a list of chat members. // // Well, I tried. Maybe I'll do something with these limitations. Someday. Or not. Who knows? Not me! var kaomojis = []string{ "(●´ω`●)", "( ͡° ͜ʖ ͡°)", "¯\\_(ツ)_/¯", "(╯°□°)╯︵ ┻━┻", "┻━┻ ︵╰(°□°╰)", "(☞゚ヮ゚)☞ ┻━┻", "(ノಠ益ಠ)ノ", "┬─┬ノ( º _ ºノ)", "ლ(ಠ_ಠლ)", "( つ ◕_◕ )つ", "◔_◔", "●_●", } type InlineQueryHandler struct { iface.Base } func NewInlineQueryHandler(app iface.App) Handler { return &InlineQueryHandler{iface.NewBase(app, 0, 0)} } func (h *InlineQueryHandler) Handle(wh telego.Update) error { return h.App.TG().AnswerInlineQuery(h.kaomojiResults(wh.InlineQuery.ID)) } func (h *InlineQueryHandler) kaomojiResults(id string) *telego.AnswerInlineQueryParams { results := make([]telego.InlineQueryResult, len(kaomojis)) for i, kaomoji := range kaomojis { results[i] = &telego.InlineQueryResultArticle{ Type: "article", ID: kaomoji, Title: kaomoji, InputMessageContent: &telego.InputTextMessageContent{ MessageText: kaomoji, }, } } return tu.InlineQuery(id, results...) }