Otann / morse

📡 Clojure interface for Telegram Bot API
Eclipse Public License 1.0
257 stars 48 forks source link

Update handler #38

Closed Sandarr95 closed 4 years ago

Sandarr95 commented 6 years ago

Hi,

I want to use a feature of the api which doesn't have an explicit handler, luckily I can just:

(h/update-fn [:chosen_inline_result]
  (fn [{:keys [inline_message_id query]}]
    (println "Registering " inline_message_id "\n" query)
    (k/assoc-in db [inline_message_id] (register-question query))))

But then I noticed my function still got called on normal messages. I propose therefore a change: https://github.com/Otann/morse/blob/35ced7195428474dd7e1567c2051baed42f36fbc/src/morse/handlers.clj#L56

    (if-let [data (get-in update path)]

Hopefully you agree, if I have overlooked something let me know.

Sander

Sandarr95 commented 4 years ago

Fixed in https://github.com/Otann/morse/commit/895271d7d6b176eee753c18cf0cd2b1bde4c56cc