@theholocron/discord-client 1.47.0 → 1.48.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 +1 -1
- package/dist/index.d.mts +23 -1
- package/dist/index.mjs +15 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ the create response.
|
|
|
102
102
|
| Resource | Methods |
|
|
103
103
|
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
104
104
|
| `client.users` | `me()` — `GET /users/@me`, a cheap token check; `get(id)` — a user's name |
|
|
105
|
-
| `client.application` | `get`, `modify` (the bot's own application: description, tags, install settings, URLs)
|
|
105
|
+
| `client.application` | `get`, `modify` (the bot's own application: description, tags, install settings, URLs, and `flags` for the privileged-intent toggles; `redirect_uris` can be read but not written, so add them in the developer portal) |
|
|
106
106
|
| `client.guilds` | `get`, `modify`, `channels`, `createChannel`, `roles`, `createRole`, `modifyRole`, `create`, `delete`, `emojis`, `member`, `members`, `membersWithRole`, `addMemberRole`, `removeMemberRole`, `welcomeScreen`, `modifyWelcomeScreen`, `onboarding`, `modifyOnboarding` |
|
|
107
107
|
| `client.channels` | `modify`, `webhooks`, `createWebhook`, `createMessage`, `createInvite`, `messages`, `pin`, `deleteMessage` |
|
|
108
108
|
| `client.webhooks` | `modify` (name, avatar), `delete` |
|
package/dist/index.d.mts
CHANGED
|
@@ -238,6 +238,18 @@ interface DiscordInstallParams {
|
|
|
238
238
|
/** Permission bitfield the default install link asks for, as a string. */
|
|
239
239
|
permissions: string;
|
|
240
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Bits of the application's `flags`. The `*Limited` ones are the portal's privileged-intent toggles for an app
|
|
243
|
+
* that Discord has not verified; once verified, the plain ones take over and the toggle is Discord's to change.
|
|
244
|
+
*/
|
|
245
|
+
declare const ApplicationFlag: {
|
|
246
|
+
readonly GatewayPresence: number;
|
|
247
|
+
readonly GatewayPresenceLimited: number;
|
|
248
|
+
readonly GatewayGuildMembers: number;
|
|
249
|
+
readonly GatewayGuildMembersLimited: number;
|
|
250
|
+
readonly GatewayMessageContent: number;
|
|
251
|
+
readonly GatewayMessageContentLimited: number;
|
|
252
|
+
};
|
|
241
253
|
/** The bot's own application, as `GET /applications/@me` returns it. Fields Discord leaves out are absent or null. */
|
|
242
254
|
interface DiscordApplication {
|
|
243
255
|
id: string;
|
|
@@ -257,6 +269,11 @@ interface DiscordApplication {
|
|
|
257
269
|
bot_public?: boolean;
|
|
258
270
|
bot_require_code_grant?: boolean;
|
|
259
271
|
flags?: number;
|
|
272
|
+
/**
|
|
273
|
+
* The OAuth2 redirect URIs registered on the application. Read-only here: Discord accepts a write to this
|
|
274
|
+
* field and silently ignores it, so add them in the developer portal (OAuth2 → Redirects).
|
|
275
|
+
*/
|
|
276
|
+
redirect_uris?: string[];
|
|
260
277
|
}
|
|
261
278
|
/** What `PATCH /applications/@me` takes; a field left out is left alone, and `null` clears the ones that can be cleared. */
|
|
262
279
|
interface ModifyApplicationInput {
|
|
@@ -268,6 +285,11 @@ interface ModifyApplicationInput {
|
|
|
268
285
|
terms_of_service_url?: string | null;
|
|
269
286
|
privacy_policy_url?: string | null;
|
|
270
287
|
interactions_endpoint_url?: string | null;
|
|
288
|
+
/**
|
|
289
|
+
* The whole flags value. Discord keeps only the bits an app may change (the `*Limited` privileged-intent
|
|
290
|
+
* toggles among them), so read `flags` first and send it back with your bit set or cleared.
|
|
291
|
+
*/
|
|
292
|
+
flags?: number;
|
|
271
293
|
}
|
|
272
294
|
interface ModifyWebhookInput {
|
|
273
295
|
name?: string;
|
|
@@ -589,4 +611,4 @@ declare function createDiscordClient(opts?: DiscordClientOptions): {
|
|
|
589
611
|
};
|
|
590
612
|
type DiscordClient = ReturnType<typeof createDiscordClient>;
|
|
591
613
|
//#endregion
|
|
592
|
-
export { ChannelType, CreateChannelInput, CreateGuildInput, CreateInviteInput, CreateMessageInput, CreateRoleInput, DEFAULT_STATE_TTL_SECONDS, DiscordApplication, DiscordBotClient, DiscordBotClientOptions, DiscordChannel, DiscordChannelMessage, DiscordChannelWebhook, DiscordClient, type DiscordClientOptions, DiscordConnection, DiscordEmoji, DiscordGuild, DiscordGuildMember, DiscordInstallParams, DiscordInvite, DiscordMessage, DiscordOAuthClient, DiscordOAuthClientOptions, DiscordOAuthScope, DiscordOAuthToken, DiscordOAuthUser, DiscordOnboarding, DiscordOnboardingOption, DiscordOnboardingPrompt, DiscordPermissionOverwrite, DiscordRole, DiscordUser, type DiscordWebhookInfo, DiscordWelcomeChannel, DiscordWelcomeScreen, ListMembersInput, ModifyApplicationInput, ModifyChannelInput, ModifyGuildInput, ModifyRoleInput, ModifyWebhookInput, ModifyWelcomeScreenInput, Permission, PermissionName, createDiscordBotClient, createDiscordClient, createDiscordOAuthClient, findVerifiedConnection, parseWebhookUrl, permissionNames, permissions, signOAuthState, verifyOAuthState };
|
|
614
|
+
export { ApplicationFlag, ChannelType, CreateChannelInput, CreateGuildInput, CreateInviteInput, CreateMessageInput, CreateRoleInput, DEFAULT_STATE_TTL_SECONDS, DiscordApplication, DiscordBotClient, DiscordBotClientOptions, DiscordChannel, DiscordChannelMessage, DiscordChannelWebhook, DiscordClient, type DiscordClientOptions, DiscordConnection, DiscordEmoji, DiscordGuild, DiscordGuildMember, DiscordInstallParams, DiscordInvite, DiscordMessage, DiscordOAuthClient, DiscordOAuthClientOptions, DiscordOAuthScope, DiscordOAuthToken, DiscordOAuthUser, DiscordOnboarding, DiscordOnboardingOption, DiscordOnboardingPrompt, DiscordPermissionOverwrite, DiscordRole, DiscordUser, type DiscordWebhookInfo, DiscordWelcomeChannel, DiscordWelcomeScreen, ListMembersInput, ModifyApplicationInput, ModifyChannelInput, ModifyGuildInput, ModifyRoleInput, ModifyWebhookInput, ModifyWelcomeScreenInput, Permission, PermissionName, createDiscordBotClient, createDiscordClient, createDiscordOAuthClient, findVerifiedConnection, parseWebhookUrl, permissionNames, permissions, signOAuthState, verifyOAuthState };
|
package/dist/index.mjs
CHANGED
|
@@ -239,11 +239,12 @@ function createDiscordBotClient(opts) {
|
|
|
239
239
|
const wanted = id(roleId);
|
|
240
240
|
const found = [];
|
|
241
241
|
let after;
|
|
242
|
-
for (let page = 0; page
|
|
242
|
+
for (let page = 0; page <= MAX_MEMBER_PAGES; page++) {
|
|
243
243
|
const batch = await rest.request(`/guilds/${id(guildId)}/members`, { query: {
|
|
244
244
|
limit: "1000",
|
|
245
245
|
...after === void 0 ? {} : { after }
|
|
246
246
|
} });
|
|
247
|
+
if (page === MAX_MEMBER_PAGES && batch.length > 0) break;
|
|
247
248
|
for (const m of batch) if (m.roles.includes(wanted)) found.push(m);
|
|
248
249
|
const last = batch[batch.length - 1]?.user?.id;
|
|
249
250
|
if (batch.length < 1e3 || last === void 0) return found;
|
|
@@ -342,6 +343,18 @@ const ChannelType = {
|
|
|
342
343
|
Announcement: 5,
|
|
343
344
|
Forum: 15
|
|
344
345
|
};
|
|
346
|
+
/**
|
|
347
|
+
* Bits of the application's `flags`. The `*Limited` ones are the portal's privileged-intent toggles for an app
|
|
348
|
+
* that Discord has not verified; once verified, the plain ones take over and the toggle is Discord's to change.
|
|
349
|
+
*/
|
|
350
|
+
const ApplicationFlag = {
|
|
351
|
+
GatewayPresence: 4096,
|
|
352
|
+
GatewayPresenceLimited: 8192,
|
|
353
|
+
GatewayGuildMembers: 16384,
|
|
354
|
+
GatewayGuildMembersLimited: 32768,
|
|
355
|
+
GatewayMessageContent: 1 << 18,
|
|
356
|
+
GatewayMessageContentLimited: 1 << 19
|
|
357
|
+
};
|
|
345
358
|
//#endregion
|
|
346
359
|
//#region ../../../../../src/bot/permissions.ts
|
|
347
360
|
/**
|
|
@@ -549,4 +562,4 @@ function createDiscordClient(opts = {}) {
|
|
|
549
562
|
return { webhooks: webhooks(opts.baseUrl ?? "https://discord.com/api/v10", opts.fetch ?? globalThis.fetch) };
|
|
550
563
|
}
|
|
551
564
|
//#endregion
|
|
552
|
-
export { ChannelType, DEFAULT_STATE_TTL_SECONDS, Permission, createDiscordBotClient, createDiscordClient, createDiscordOAuthClient, findVerifiedConnection, parseWebhookUrl, permissionNames, permissions, signOAuthState, verifyOAuthState };
|
|
565
|
+
export { ApplicationFlag, ChannelType, DEFAULT_STATE_TTL_SECONDS, Permission, createDiscordBotClient, createDiscordClient, createDiscordOAuthClient, findVerifiedConnection, parseWebhookUrl, permissionNames, permissions, signOAuthState, verifyOAuthState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theholocron/discord-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.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.48.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@theholocron/cli": "5.0.0-alpha.79",
|