mirror of
https://github.com/sern-handler/tools
synced 2026-06-06 01:16:59 +00:00
a little cleaner
This commit is contained in:
@@ -12,9 +12,6 @@
|
||||
"devDependencies": {
|
||||
"shadow-cljs": "^2.8.52",
|
||||
"source-map-support": "^0.5.13"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
|
||||
@@ -28,7 +28,9 @@
|
||||
(subs (str ky) 1))
|
||||
|
||||
(def actions (into {}
|
||||
(for [[k v] routes] [(keyword->str k) (request-init k)])))
|
||||
(map (fn [[k v]] [(keyword->str k) (request-init k)]))
|
||||
routes
|
||||
))
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
|
||||
(defn processed-url [remaining-url opts]
|
||||
(-> (str base-url remaining-url)
|
||||
(replace #"\{application\.id\}" (.-app_id opts))
|
||||
(replace #"\{guild\.id\}" (.-guild_id opts))
|
||||
(replace #"\{command\.id\}" (.-command_id opts))))
|
||||
(replace #"\{application\.id\}" (.-app_id ^js opts))
|
||||
(replace #"\{guild\.id\}" (.-guild_id ^js opts))
|
||||
(replace #"\{command\.id\}" (.-command_id ^js opts))))
|
||||
|
||||
(defn poster [token, appid]
|
||||
(let [header #js{ "Content-Type" "application/json"
|
||||
@@ -16,6 +16,6 @@
|
||||
(fn [action opts]
|
||||
(let [ [url mkrequest] (actions action)
|
||||
full-url (processed-url url #js { "app_id" appid
|
||||
"guild_id" (.-guild_id opts)
|
||||
"command_id" (.-command_id opts) })]
|
||||
(js/fetch full-url (mkrequest (.-body opts ) header))))))
|
||||
"guild_id" (.-guild_id ^js opts)
|
||||
"command_id" (.-command_id ^js opts) })]
|
||||
(js/fetch full-url (mkrequest (.-body ^js opts ) header))))))
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import poster from '../dist/index.js';
|
||||
|
||||
const client = poster("token", "appid");
|
||||
const send = poster("token", "appid");
|
||||
|
||||
|
||||
const req = await client("global/put", { });
|
||||
const req = await send("global/put", { });
|
||||
|
||||
|
||||
console.log(req);
|
||||
|
||||
Reference in New Issue
Block a user