gizmo385/discord.clj

Duplicated DM help message on command trigger

Opened this issue · 6 comments

When triggering the <prefix>help command (auto-handled by the library), it sends two messages instead of one.

My core code is

(ns disclojure.core
  (:gen-class)
  (:require [discord.bot :as bot]))

(defn -main
  "Boots the bot."
  [& _]
  (bot/start))

Are the two messages duplicates of one another?

The second message is an exact duplicate of the first message, as the following screenshot demonstrates.

image

Thanks to the 400 error on Help when tweaking with entries (#16), I noticed that the library does indeed send two messages:

19-08-29 23:41:07 Artemis-pc ERROR [discord.client:77] - Error sending message: clojure.lang.ExceptionInfo: clj-http: status 400 {:request-time 198, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :chunked? false, :type :clj-http.client/unexceptional-status, :reason-phrase "BAD REQUEST", :headers {...}, :orig-content-encoding nil, :status 400, :length 21, :body "{\"embed\": [\"fields\"]}", :trace-redirects []}     
19-08-29 23:41:07 Artemis-pc ERROR [discord.client:77] - Error sending message: clojure.lang.ExceptionInfo: clj-http: status 400 {:request-time 194, :repeatable? false, :protocol-version {:name "HTTP", :major 1, :minor 1}, :streaming? true, :chunked? false, :type :clj-http.client/unexceptional-status, :reason-phrase "BAD REQUEST", :headers {...}, :orig-content-encoding nil, :status 400, :length 21, :body "{\"embed\": [\"fields\"]}", :trace-redirects []}

Hmmm that's interesting. Is there anything additional necessary to replicate the issue? Or does it do it immediately upon <prefix>help invocation after bot startup?

I just created an empty discord.clj project, only containing the main (bot/start), and the help command sends two messages.

I think I've discovered the issue. I think this defcommand needs to be removed. The help and reload commands are handled specially, so that they're loaded correctly when the envrionment is reloaded, but the defcommand is causing 2 extensions with that functionality to be defined.

I'll work on getting that removed :)