pmonks / discljord-utils Goto Github PK
View Code? Open in Web Editor NEWCommon utilities on top of the discljord library
License: Apache License 2.0
Common utilities on top of the discljord library
License: Apache License 2.0
(defn send-dm!
"Convenience method that creates a DM channel to the specified user and sends the given message to them."
[discord-message-channel user-id message]
(let [dm-channel (dr/create-dm! discord-message-channel user-id)
channel-id (:id dm-channel)]
(dr/create-message! discord-message-channel channel-id :content message)))
(defmethod handle-event :message-create [_ {:keys [channel-id id] :as data}]
(println data)
(println
@(send-dm!
(:rest @state)
(-> data :author :id)
(str "Hello " (-> data :author :username)))))
(where dr
is discljord.messaging)
something like this would result in an error:
#error {
:cause
:data {:message 405: Method Not Allowed, :code 0}
:via
[{:type clojure.lang.ExceptionInfo
:message
:data {:message 405: Method Not Allowed, :code 0}
:at [discljord.messaging.impl$eval16286$fn__16288 invoke impl.clj 153]}]
:trace
[[discljord.messaging.impl$eval16286$fn__16288 invoke impl.clj 153]
[clojure.lang.MultiFn invoke MultiFn.java 239]
[discljord.messaging.impl$make_request_BANG_$make_request__18011 invoke impl.clj 796]
[discljord.messaging.impl$make_request_BANG_ invokeStatic impl.clj 801]
[discljord.messaging.impl$make_request_BANG_ invoke impl.clj 775]
[discljord.messaging.impl$step_agent$fn__18035 invoke impl.clj 846]
[clojure.core$binding_conveyor_fn$fn__5772 invoke core.clj 2037]
[clojure.lang.AFn applyToHelper AFn.java 154]
[clojure.lang.RestFn applyTo RestFn.java 132]
[clojure.lang.Agent$Action doRun Agent.java 114]
[clojure.lang.Agent$Action run Agent.java 163]
[java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1130]
[java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 630]
[java.lang.Thread run Thread.java 831]]}
the promise returned by create-dm! needs to be derefered then it works
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.