discord.clj icon indicating copy to clipboard operation
discord.clj copied to clipboard

Duplicated DM help message on command trigger

Open Arteneko opened this issue 5 years ago • 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))

Arteneko avatar Aug 28 '19 22:08 Arteneko

Are the two messages duplicates of one another?

gizmo385 avatar Aug 29 '19 18:08 gizmo385

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

image

Arteneko avatar Aug 29 '19 19:08 Arteneko

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 []}

Arteneko avatar Aug 29 '19 23:08 Arteneko

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?

gizmo385 avatar Sep 03 '19 04:09 gizmo385

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

Arteneko avatar Sep 03 '19 06:09 Arteneko

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 :)

gizmo385 avatar Sep 04 '19 21:09 gizmo385