@theholocron/discord-client 1.44.0 → 1.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/index.d.mts +45 -1
- package/dist/index.mjs +9 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -99,12 +99,13 @@ the resource, look it up by name before creating it again. A webhook created
|
|
|
99
99
|
that way cannot have its URL read back, since Discord returns the token only on
|
|
100
100
|
the create response.
|
|
101
101
|
|
|
102
|
-
| Resource
|
|
103
|
-
|
|
|
104
|
-
| `client.users`
|
|
105
|
-
| `client.
|
|
106
|
-
| `client.
|
|
107
|
-
| `client.
|
|
102
|
+
| Resource | Methods |
|
|
103
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
104
|
+
| `client.users` | `me()` — `GET /users/@me`, a cheap token check |
|
|
105
|
+
| `client.application` | `get`, `modify` (the bot's own application: description, tags, install settings, URLs) |
|
|
106
|
+
| `client.guilds` | `get`, `modify`, `channels`, `createChannel`, `roles`, `createRole`, `modifyRole`, `welcomeScreen`, `modifyWelcomeScreen`, `onboarding`, `modifyOnboarding` |
|
|
107
|
+
| `client.channels` | `modify`, `webhooks`, `createWebhook`, `createMessage` |
|
|
108
|
+
| `client.webhooks` | `modify` (name, avatar), `delete` |
|
|
108
109
|
|
|
109
110
|
`permissions([...names])` builds the decimal-string bitfield Discord expects, and
|
|
110
111
|
`permissionNames(bitfield)` reads one back; `Permission` holds the bits themselves.
|
package/dist/index.d.mts
CHANGED
|
@@ -219,6 +219,44 @@ interface DiscordMessage {
|
|
|
219
219
|
channel_id: string;
|
|
220
220
|
content: string;
|
|
221
221
|
}
|
|
222
|
+
/** How the bot is added to a server or an account. */
|
|
223
|
+
interface DiscordInstallParams {
|
|
224
|
+
/** OAuth scopes, e.g. `bot`, `applications.commands`. */
|
|
225
|
+
scopes: string[];
|
|
226
|
+
/** Permission bitfield the default install link asks for, as a string. */
|
|
227
|
+
permissions: string;
|
|
228
|
+
}
|
|
229
|
+
/** The bot's own application, as `GET /applications/@me` returns it. Fields Discord leaves out are absent or null. */
|
|
230
|
+
interface DiscordApplication {
|
|
231
|
+
id: string;
|
|
232
|
+
name: string;
|
|
233
|
+
description?: string | null;
|
|
234
|
+
/** Up to five short labels shown on the application's page. */
|
|
235
|
+
tags?: string[];
|
|
236
|
+
/** The default install link's scopes and permissions. */
|
|
237
|
+
install_params?: DiscordInstallParams;
|
|
238
|
+
/** Used instead of the default install link when set. */
|
|
239
|
+
custom_install_url?: string | null;
|
|
240
|
+
role_connections_verification_url?: string | null;
|
|
241
|
+
terms_of_service_url?: string | null;
|
|
242
|
+
privacy_policy_url?: string | null;
|
|
243
|
+
interactions_endpoint_url?: string | null;
|
|
244
|
+
/** Whether anyone can add the bot (`true`) or only its owner. */
|
|
245
|
+
bot_public?: boolean;
|
|
246
|
+
bot_require_code_grant?: boolean;
|
|
247
|
+
flags?: number;
|
|
248
|
+
}
|
|
249
|
+
/** What `PATCH /applications/@me` takes; a field left out is left alone, and `null` clears the ones that can be cleared. */
|
|
250
|
+
interface ModifyApplicationInput {
|
|
251
|
+
description?: string;
|
|
252
|
+
tags?: string[];
|
|
253
|
+
install_params?: DiscordInstallParams;
|
|
254
|
+
custom_install_url?: string | null;
|
|
255
|
+
role_connections_verification_url?: string | null;
|
|
256
|
+
terms_of_service_url?: string | null;
|
|
257
|
+
privacy_policy_url?: string | null;
|
|
258
|
+
interactions_endpoint_url?: string | null;
|
|
259
|
+
}
|
|
222
260
|
interface ModifyWebhookInput {
|
|
223
261
|
name?: string;
|
|
224
262
|
/** A data URI (`data:image/png;base64,...`); `null` clears it. */
|
|
@@ -270,6 +308,12 @@ declare function createDiscordBotClient(opts: DiscordBotClientOptions): {
|
|
|
270
308
|
name: string;
|
|
271
309
|
}) => Promise<DiscordChannelWebhook>;
|
|
272
310
|
};
|
|
311
|
+
application: {
|
|
312
|
+
/** `GET /applications/@me` — the bot's own application: description, tags, install settings, URLs. */
|
|
313
|
+
get: () => Promise<DiscordApplication>;
|
|
314
|
+
/** `PATCH /applications/@me` — only what is in the body changes. */
|
|
315
|
+
modify: (body: ModifyApplicationInput) => Promise<DiscordApplication>;
|
|
316
|
+
};
|
|
273
317
|
webhooks: {
|
|
274
318
|
/** `PATCH /webhooks/:id` — name and avatar of a webhook this bot manages. */
|
|
275
319
|
modify: (webhookId: string, body: ModifyWebhookInput) => Promise<DiscordChannelWebhook>;
|
|
@@ -353,4 +397,4 @@ declare function createDiscordClient(opts?: DiscordClientOptions): {
|
|
|
353
397
|
};
|
|
354
398
|
type DiscordClient = ReturnType<typeof createDiscordClient>;
|
|
355
399
|
//#endregion
|
|
356
|
-
export { ChannelType, CreateChannelInput, CreateMessageInput, CreateRoleInput, DiscordBotClient, DiscordBotClientOptions, DiscordChannel, DiscordChannelWebhook, DiscordClient, type DiscordClientOptions, DiscordEmoji, DiscordGuild, DiscordMessage, DiscordOnboarding, DiscordOnboardingOption, DiscordOnboardingPrompt, DiscordPermissionOverwrite, DiscordRole, DiscordUser, type DiscordWebhookInfo, DiscordWelcomeChannel, DiscordWelcomeScreen, ModifyChannelInput, ModifyGuildInput, ModifyRoleInput, ModifyWebhookInput, ModifyWelcomeScreenInput, Permission, PermissionName, createDiscordBotClient, createDiscordClient, parseWebhookUrl, permissionNames, permissions };
|
|
400
|
+
export { ChannelType, CreateChannelInput, CreateMessageInput, CreateRoleInput, DiscordApplication, DiscordBotClient, DiscordBotClientOptions, DiscordChannel, DiscordChannelWebhook, DiscordClient, type DiscordClientOptions, DiscordEmoji, DiscordGuild, DiscordInstallParams, DiscordMessage, DiscordOnboarding, DiscordOnboardingOption, DiscordOnboardingPrompt, DiscordPermissionOverwrite, DiscordRole, DiscordUser, type DiscordWebhookInfo, DiscordWelcomeChannel, DiscordWelcomeScreen, ModifyApplicationInput, ModifyChannelInput, ModifyGuildInput, ModifyRoleInput, ModifyWebhookInput, ModifyWelcomeScreenInput, Permission, PermissionName, createDiscordBotClient, createDiscordClient, parseWebhookUrl, permissionNames, permissions };
|
package/dist/index.mjs
CHANGED
|
@@ -193,6 +193,15 @@ me: () => rest.request("/users/@me") },
|
|
|
193
193
|
body
|
|
194
194
|
}))
|
|
195
195
|
},
|
|
196
|
+
application: {
|
|
197
|
+
/** `GET /applications/@me` — the bot's own application: description, tags, install settings, URLs. */
|
|
198
|
+
get: () => rest.request("/applications/@me"),
|
|
199
|
+
/** `PATCH /applications/@me` — only what is in the body changes. */
|
|
200
|
+
modify: (body) => rest.request("/applications/@me", {
|
|
201
|
+
method: "PATCH",
|
|
202
|
+
body
|
|
203
|
+
})
|
|
204
|
+
},
|
|
196
205
|
webhooks: {
|
|
197
206
|
/** `PATCH /webhooks/:id` — name and avatar of a webhook this bot manages. */
|
|
198
207
|
modify: async (webhookId, body) => withUrl(await rest.request(`/webhooks/${id(webhookId)}`, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/discord-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.45.0",
|
|
4
4
|
"description": "A TypeScript client for the Discord webhooks API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"dist"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@theholocron/http-client": "^1.
|
|
35
|
+
"@theholocron/http-client": "^1.45.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@theholocron/cli": "5.0.0-alpha.79",
|