mirror of
https://github.com/sern-handler/tools
synced 2026-06-06 01:16:59 +00:00
fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sern/poster",
|
||||
"version": "1.2.5",
|
||||
"version": "1.2.6",
|
||||
"description": "Post discord application commands",
|
||||
"types": "./dist/index.d.ts",
|
||||
"main": "./dist/index.mjs",
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
(-> (str base remaining-url)
|
||||
(s/replace #"\{application\.id\}" (or (.-app_id ^js opts) ""))
|
||||
(s/replace #"\{guild\.id\}" (or (.-guild_id ^js opts) ""))
|
||||
(s/replace #"\{user\.id\}" (or (.-guild_id ^js opts) ""))
|
||||
(s/replace #"\{user\.id\}" (or (.-user_id ^js opts) ""))
|
||||
(s/replace #"\{command\.id\}" (or (.-command_id ^js opts) ""))))
|
||||
|
||||
(defn- ?params [^js query]
|
||||
@@ -29,7 +29,10 @@
|
||||
(^:async fn [action opts]
|
||||
(let [[url mkrequest] (get actions action)
|
||||
appid (js-await (fetch-application header))
|
||||
options {:app_id appid :guild_id (.-guild_id opts) :command_id (.-command_id opts)}
|
||||
options {:app_id appid
|
||||
:guild_id (.-guild_id opts)
|
||||
:command_id (.-command_id opts)
|
||||
:user_id (.-user_id opts) }
|
||||
url (new js/URL (inject url options)) ]
|
||||
(set! (.-search url) (?params (.-query opts)))
|
||||
(js/fetch url (mkrequest (.-body opts) header))))))
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import poster, { type GlobalPut } from '../dist/index.js';
|
||||
import poster, { type GlobalPut, type TypedResponse } from '../dist/index.js';
|
||||
|
||||
const send = await poster.client("MTI0MTA4MzI5NDYzNzA5NzAyMQ.G8EKXD.q4s-pDrim6SnHcsPrFY3uQpn_8SCF8-vSPYZ48");
|
||||
|
||||
const send = await poster.client("token");
|
||||
|
||||
const req = await send("user/get", {
|
||||
user_id: ""
|
||||
}); //cast for full typed safety
|
||||
}) as TypedResponse<GlobalPut>; //cast for full typed safety
|
||||
|
||||
if(poster.isOk<GlobalPut>(req)) {
|
||||
req.json().then(s => s?.map(v => v.name))
|
||||
|
||||
Reference in New Issue
Block a user