discord.js 15.0.0-dev.1737720285-670667d65 → 15.0.0-dev.1737850362-695f59236
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/package.json +4 -4
- package/src/managers/ApplicationCommandManager.js +34 -12
- package/src/managers/GuildMemberManager.js +5 -12
- package/src/managers/VoiceStateManager.js +1 -1
- package/src/structures/Guild.js +2 -2
- package/src/structures/GuildChannel.js +1 -1
- package/src/structures/PermissionOverwrites.js +2 -2
- package/src/structures/ThreadChannel.js +1 -1
- package/typings/index.d.mts +19 -21
- package/typings/index.d.ts +19 -21
- package/typings/index.test-d.ts +4 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "discord.js",
|
|
4
|
-
"version": "15.0.0-dev.
|
|
4
|
+
"version": "15.0.0-dev.1737850362-695f59236",
|
|
5
5
|
"description": "A powerful library for interacting with the Discord API",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"types": "./typings/index.d.ts",
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
"tslib": "^2.8.1",
|
|
62
62
|
"undici": "6.21.0",
|
|
63
63
|
"@discordjs/collection": "^2.1.1",
|
|
64
|
-
"@discordjs/
|
|
64
|
+
"@discordjs/rest": "^2.4.0",
|
|
65
65
|
"@discordjs/util": "^1.1.1",
|
|
66
|
-
"@discordjs/
|
|
67
|
-
"@discordjs/
|
|
66
|
+
"@discordjs/formatters": "^0.5.0",
|
|
67
|
+
"@discordjs/ws": "^2.0.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@favware/cliff-jumper": "^4.1.0",
|
|
@@ -81,6 +81,7 @@ class ApplicationCommandManager extends CachedManager {
|
|
|
81
81
|
/**
|
|
82
82
|
* Options used to fetch Application Commands from Discord
|
|
83
83
|
* @typedef {BaseFetchOptions} FetchApplicationCommandOptions
|
|
84
|
+
* @property {Snowflake} [id] The command's id to fetch
|
|
84
85
|
* @property {Snowflake} [guildId] The guild's id to fetch commands for, for when the guild is not cached
|
|
85
86
|
* @property {Locale} [locale] The locale to use when fetching this command
|
|
86
87
|
* @property {boolean} [withLocalizations] Whether to fetch all localization data
|
|
@@ -88,8 +89,7 @@ class ApplicationCommandManager extends CachedManager {
|
|
|
88
89
|
|
|
89
90
|
/**
|
|
90
91
|
* Obtains one or multiple application commands from Discord, or the cache if it's already available.
|
|
91
|
-
* @param {Snowflake|FetchApplicationCommandOptions} [
|
|
92
|
-
* @param {FetchApplicationCommandOptions} [options] Additional options for this fetch
|
|
92
|
+
* @param {Snowflake|FetchApplicationCommandOptions} [options] Options for fetching application command(s)
|
|
93
93
|
* @returns {Promise<ApplicationCommand|Collection<Snowflake, ApplicationCommand>>}
|
|
94
94
|
* @example
|
|
95
95
|
* // Fetch a single command
|
|
@@ -98,28 +98,50 @@ class ApplicationCommandManager extends CachedManager {
|
|
|
98
98
|
* .catch(console.error);
|
|
99
99
|
* @example
|
|
100
100
|
* // Fetch all commands
|
|
101
|
+
* client.application.commands.fetch()
|
|
102
|
+
* .then(commands => console.log(`Fetched ${commands.size} commands`))
|
|
103
|
+
* .catch(console.error);
|
|
104
|
+
* @example
|
|
105
|
+
* // Fetch all commands in a guild
|
|
101
106
|
* guild.commands.fetch()
|
|
102
107
|
* .then(commands => console.log(`Fetched ${commands.size} commands`))
|
|
103
108
|
* .catch(console.error);
|
|
109
|
+
* @example
|
|
110
|
+
* // Fetch a single command without checking cache
|
|
111
|
+
* guild.commands.fetch({ id: '123456789012345678', force: true })
|
|
112
|
+
* .then(command => console.log(`Fetched command ${command.name}`))
|
|
113
|
+
* .catch(console.error)
|
|
104
114
|
*/
|
|
105
|
-
async fetch(
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
async fetch(options) {
|
|
116
|
+
if (!options) return this._fetchMany();
|
|
117
|
+
|
|
118
|
+
if (typeof options === 'string') return this._fetchSingle({ id: options });
|
|
119
|
+
|
|
120
|
+
const { cache, force, guildId, id, locale, withLocalizations } = options;
|
|
121
|
+
|
|
122
|
+
if (id) return this._fetchSingle({ cache, force, guildId, id });
|
|
123
|
+
|
|
124
|
+
return this._fetchMany({ cache, guildId, locale, withLocalizations });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async _fetchSingle({ cache, force = false, guildId, id }) {
|
|
128
|
+
if (!force) {
|
|
129
|
+
const existing = this.cache.get(id);
|
|
130
|
+
if (existing) return existing;
|
|
115
131
|
}
|
|
116
132
|
|
|
133
|
+
const command = await this.client.rest.get(this.commandPath({ id, guildId }));
|
|
134
|
+
return this._add(command, cache);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async _fetchMany({ cache, guildId, locale, withLocalizations } = {}) {
|
|
117
138
|
const data = await this.client.rest.get(this.commandPath({ guildId }), {
|
|
118
139
|
headers: {
|
|
119
140
|
'X-Discord-Locale': locale,
|
|
120
141
|
},
|
|
121
142
|
query: makeURLSearchParams({ with_localizations: withLocalizations }),
|
|
122
143
|
});
|
|
144
|
+
|
|
123
145
|
return data.reduce((coll, command) => coll.set(command.id, this._add(command, cache, guildId)), new Collection());
|
|
124
146
|
}
|
|
125
147
|
|
|
@@ -40,15 +40,8 @@ class GuildMemberManager extends CachedManager {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* * A User resolvable
|
|
46
|
-
* @typedef {GuildMember|UserResolvable} GuildMemberResolvable
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Resolves a {@link GuildMemberResolvable} to a {@link GuildMember} object.
|
|
51
|
-
* @param {GuildMemberResolvable} member The user that is part of the guild
|
|
43
|
+
* Resolves a {@link UserResolvable} to a {@link GuildMember} object.
|
|
44
|
+
* @param {UserResolvable} member The user that is part of the guild
|
|
52
45
|
* @returns {?GuildMember}
|
|
53
46
|
*/
|
|
54
47
|
resolve(member) {
|
|
@@ -60,8 +53,8 @@ class GuildMemberManager extends CachedManager {
|
|
|
60
53
|
}
|
|
61
54
|
|
|
62
55
|
/**
|
|
63
|
-
* Resolves a {@link
|
|
64
|
-
* @param {
|
|
56
|
+
* Resolves a {@link UserResolvable} to a member id.
|
|
57
|
+
* @param {UserResolvable} member The user that is part of the guild
|
|
65
58
|
* @returns {?Snowflake}
|
|
66
59
|
*/
|
|
67
60
|
resolveId(member) {
|
|
@@ -512,7 +505,7 @@ class GuildMemberManager extends CachedManager {
|
|
|
512
505
|
/**
|
|
513
506
|
* Options used for adding or removing a role from a member.
|
|
514
507
|
* @typedef {Object} AddOrRemoveGuildMemberRoleOptions
|
|
515
|
-
* @property {
|
|
508
|
+
* @property {UserResolvable} user The user to add/remove the role from
|
|
516
509
|
* @property {RoleResolvable} role The role to add/remove
|
|
517
510
|
* @property {string} [reason] Reason for adding/removing the role
|
|
518
511
|
*/
|
|
@@ -36,7 +36,7 @@ class VoiceStateManager extends CachedManager {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Obtains a user's voice state from discord or from the cache if it's already available.
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {UserResolvable|'@me'} member The member whose voice state is to be fetched
|
|
40
40
|
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
|
41
41
|
* @returns {Promise<VoiceState>}
|
|
42
42
|
* @example
|
package/src/structures/Guild.js
CHANGED
|
@@ -785,7 +785,7 @@ class Guild extends AnonymousGuild {
|
|
|
785
785
|
* @property {?VoiceChannelResolvable} [afkChannel] The AFK channel of the guild
|
|
786
786
|
* @property {number} [afkTimeout] The AFK timeout of the guild
|
|
787
787
|
* @property {?(BufferResolvable|Base64Resolvable)} [icon] The icon of the guild
|
|
788
|
-
* @property {
|
|
788
|
+
* @property {UserResolvable} [owner] The owner of the guild
|
|
789
789
|
* @property {?(BufferResolvable|Base64Resolvable)} [splash] The invite splash image of the guild
|
|
790
790
|
* @property {?(BufferResolvable|Base64Resolvable)} [discoverySplash] The discovery splash image of the guild
|
|
791
791
|
* @property {?(BufferResolvable|Base64Resolvable)} [banner] The banner of the guild
|
|
@@ -1148,7 +1148,7 @@ class Guild extends AnonymousGuild {
|
|
|
1148
1148
|
|
|
1149
1149
|
/**
|
|
1150
1150
|
* Sets a new owner of the guild.
|
|
1151
|
-
* @param {
|
|
1151
|
+
* @param {UserResolvable} owner The new owner of the guild
|
|
1152
1152
|
* @param {string} [reason] Reason for setting the new owner
|
|
1153
1153
|
* @returns {Promise<Guild>}
|
|
1154
1154
|
* @example
|
|
@@ -167,7 +167,7 @@ class GuildChannel extends BaseChannel {
|
|
|
167
167
|
|
|
168
168
|
/**
|
|
169
169
|
* Gets the overall set of permissions for a member or role in this channel, taking into account channel overwrites.
|
|
170
|
-
* @param {
|
|
170
|
+
* @param {UserResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
|
|
171
171
|
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
|
|
172
172
|
* will return all permissions
|
|
173
173
|
* @returns {?Readonly<PermissionsBitField>}
|
|
@@ -157,7 +157,7 @@ class PermissionOverwrites extends Base {
|
|
|
157
157
|
/**
|
|
158
158
|
* Data that can be used for a permission overwrite
|
|
159
159
|
* @typedef {Object} OverwriteData
|
|
160
|
-
* @property {
|
|
160
|
+
* @property {UserResolvable|RoleResolvable} id Member or role this overwrite is for
|
|
161
161
|
* @property {PermissionResolvable} [allow] The permissions to allow
|
|
162
162
|
* @property {PermissionResolvable} [deny] The permissions to deny
|
|
163
163
|
* @property {OverwriteType} [type] The type of this OverwriteData (mandatory if `id` is a Snowflake)
|
|
@@ -174,7 +174,7 @@ class PermissionOverwrites extends Base {
|
|
|
174
174
|
|
|
175
175
|
const id = guild.roles.resolveId(overwrite.id) ?? guild.client.users.resolveId(overwrite.id);
|
|
176
176
|
if (!id) {
|
|
177
|
-
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'overwrite.id', '
|
|
177
|
+
throw new DiscordjsTypeError(ErrorCodes.InvalidType, 'overwrite.id', 'UserResolvable or RoleResolvable');
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
if (overwrite.type !== undefined && (typeof overwrite.type !== 'number' || !(overwrite.type in OverwriteType))) {
|
|
@@ -274,7 +274,7 @@ class ThreadChannel extends BaseChannel {
|
|
|
274
274
|
/**
|
|
275
275
|
* Gets the overall set of permissions for a member or role in this thread's parent channel, taking overwrites into
|
|
276
276
|
* account.
|
|
277
|
-
* @param {
|
|
277
|
+
* @param {UserResolvable|RoleResolvable} memberOrRole The member or role to obtain the overall permissions for
|
|
278
278
|
* @param {boolean} [checkAdmin=true] Whether having the {@link PermissionFlagsBits.Administrator} permission
|
|
279
279
|
* will return all permissions
|
|
280
280
|
* @returns {?Readonly<PermissionsBitField>}
|
package/typings/index.d.mts
CHANGED
|
@@ -1463,7 +1463,7 @@ export class Guild extends AnonymousGuild {
|
|
|
1463
1463
|
): Promise<Guild>;
|
|
1464
1464
|
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
|
1465
1465
|
public setName(name: string, reason?: string): Promise<Guild>;
|
|
1466
|
-
public setOwner(owner:
|
|
1466
|
+
public setOwner(owner: UserResolvable, reason?: string): Promise<Guild>;
|
|
1467
1467
|
public setPreferredLocale(preferredLocale: Locale | null, reason?: string): Promise<Guild>;
|
|
1468
1468
|
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
|
1469
1469
|
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
|
@@ -1564,7 +1564,7 @@ export abstract class GuildChannel extends BaseChannel {
|
|
|
1564
1564
|
public lockPermissions(): Promise<this>;
|
|
1565
1565
|
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
|
|
1566
1566
|
public permissionsFor(
|
|
1567
|
-
memberOrRole:
|
|
1567
|
+
memberOrRole: UserResolvable | RoleResolvable,
|
|
1568
1568
|
checkAdmin?: boolean,
|
|
1569
1569
|
): Readonly<PermissionsBitField> | null;
|
|
1570
1570
|
public setName(name: string, reason?: string): Promise<this>;
|
|
@@ -3321,7 +3321,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
|
|
|
3321
3321
|
public leave(): Promise<this>;
|
|
3322
3322
|
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
|
|
3323
3323
|
public permissionsFor(
|
|
3324
|
-
memberOrRole:
|
|
3324
|
+
memberOrRole: UserResolvable | RoleResolvable,
|
|
3325
3325
|
checkAdmin?: boolean,
|
|
3326
3326
|
): Readonly<PermissionsBitField> | null;
|
|
3327
3327
|
public fetchOwner(options?: FetchThreadOwnerOptions): Promise<ThreadMember>;
|
|
@@ -3913,14 +3913,13 @@ export class ApplicationCommandManager<
|
|
|
3913
3913
|
guildId: Snowflake,
|
|
3914
3914
|
): Promise<ApplicationCommand>;
|
|
3915
3915
|
public fetch(
|
|
3916
|
-
id: Snowflake,
|
|
3917
|
-
|
|
3916
|
+
options: Snowflake | (Omit<FetchApplicationCommandOptions, 'guildId'> & { id: Snowflake }),
|
|
3917
|
+
): Promise<ApplicationCommandScope>;
|
|
3918
|
+
public fetch(
|
|
3919
|
+
options: FetchApplicationCommandOptions & { id: Snowflake; guildId: Snowflake },
|
|
3918
3920
|
): Promise<ApplicationCommand>;
|
|
3919
|
-
public fetch(options: FetchApplicationCommandOptions): Promise<Collection<Snowflake, ApplicationCommandScope>>;
|
|
3920
|
-
public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise<ApplicationCommandScope>;
|
|
3921
3921
|
public fetch(
|
|
3922
|
-
|
|
3923
|
-
options?: FetchApplicationCommandOptions,
|
|
3922
|
+
options?: Omit<FetchApplicationCommandOptions, 'id'>,
|
|
3924
3923
|
): Promise<Collection<Snowflake, ApplicationCommandScope>>;
|
|
3925
3924
|
public set(
|
|
3926
3925
|
commands: readonly ApplicationCommandDataResolvable[],
|
|
@@ -4089,11 +4088,11 @@ export class GuildApplicationCommandManager extends ApplicationCommandManager<Ap
|
|
|
4089
4088
|
command: ApplicationCommandResolvable,
|
|
4090
4089
|
data: Partial<ApplicationCommandDataResolvable>,
|
|
4091
4090
|
): Promise<ApplicationCommand>;
|
|
4092
|
-
public fetch(id: Snowflake, options?: FetchGuildApplicationCommandFetchOptions): Promise<ApplicationCommand>;
|
|
4093
|
-
public fetch(options: FetchGuildApplicationCommandFetchOptions): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4094
4091
|
public fetch(
|
|
4095
|
-
id
|
|
4096
|
-
|
|
4092
|
+
options: Snowflake | (FetchGuildApplicationCommandFetchOptions & { id: Snowflake }),
|
|
4093
|
+
): Promise<ApplicationCommand>;
|
|
4094
|
+
public fetch(
|
|
4095
|
+
options?: Omit<FetchGuildApplicationCommandFetchOptions, 'id'>,
|
|
4097
4096
|
): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4098
4097
|
public set(commands: readonly ApplicationCommandDataResolvable[]): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4099
4098
|
}
|
|
@@ -4177,12 +4176,12 @@ export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvabl
|
|
|
4177
4176
|
}
|
|
4178
4177
|
|
|
4179
4178
|
export interface AddOrRemoveGuildMemberRoleOptions {
|
|
4180
|
-
user:
|
|
4179
|
+
user: UserResolvable;
|
|
4181
4180
|
role: RoleResolvable;
|
|
4182
4181
|
reason?: string;
|
|
4183
4182
|
}
|
|
4184
4183
|
|
|
4185
|
-
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember,
|
|
4184
|
+
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, UserResolvable> {
|
|
4186
4185
|
private constructor(guild: Guild, iterable?: Iterable<RawGuildMemberData>);
|
|
4187
4186
|
public guild: Guild;
|
|
4188
4187
|
public get me(): GuildMember | null;
|
|
@@ -4474,7 +4473,7 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
|
|
|
4474
4473
|
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
|
|
4475
4474
|
private constructor(guild: Guild, iterable?: Iterable<RawVoiceStateData>);
|
|
4476
4475
|
public guild: Guild;
|
|
4477
|
-
public fetch(member:
|
|
4476
|
+
public fetch(member: UserResolvable | '@me', options?: BaseFetchOptions): Promise<VoiceState>;
|
|
4478
4477
|
}
|
|
4479
4478
|
|
|
4480
4479
|
//#endregion
|
|
@@ -5461,6 +5460,7 @@ export type EmojiIdentifierResolvable =
|
|
|
5461
5460
|
export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji | ApplicationEmoji;
|
|
5462
5461
|
|
|
5463
5462
|
export interface FetchApplicationCommandOptions extends BaseFetchOptions {
|
|
5463
|
+
id?: Snowflake;
|
|
5464
5464
|
guildId?: Snowflake;
|
|
5465
5465
|
locale?: Locale;
|
|
5466
5466
|
withLocalizations?: boolean;
|
|
@@ -5856,7 +5856,7 @@ export interface GuildEditOptions {
|
|
|
5856
5856
|
afkTimeout?: number;
|
|
5857
5857
|
afkChannel?: VoiceChannelResolvable | null;
|
|
5858
5858
|
icon?: BufferResolvable | Base64Resolvable | null;
|
|
5859
|
-
owner?:
|
|
5859
|
+
owner?: UserResolvable;
|
|
5860
5860
|
splash?: BufferResolvable | Base64Resolvable | null;
|
|
5861
5861
|
discoverySplash?: BufferResolvable | Base64Resolvable | null;
|
|
5862
5862
|
banner?: BufferResolvable | Base64Resolvable | null;
|
|
@@ -5911,8 +5911,6 @@ export interface GuildMemberEditOptions {
|
|
|
5911
5911
|
reason?: string;
|
|
5912
5912
|
}
|
|
5913
5913
|
|
|
5914
|
-
export type GuildMemberResolvable = GuildMember | UserResolvable;
|
|
5915
|
-
|
|
5916
5914
|
export type GuildResolvable = Guild | NonThreadGuildBasedChannel | GuildMember | GuildEmoji | Invite | Role | Snowflake;
|
|
5917
5915
|
|
|
5918
5916
|
export interface GuildPruneMembersOptions {
|
|
@@ -6434,7 +6432,7 @@ export interface MultipleShardSpawnOptions {
|
|
|
6434
6432
|
export interface BaseOverwriteData {
|
|
6435
6433
|
allow?: PermissionResolvable;
|
|
6436
6434
|
deny?: PermissionResolvable;
|
|
6437
|
-
id:
|
|
6435
|
+
id: UserResolvable | RoleResolvable;
|
|
6438
6436
|
type?: OverwriteType;
|
|
6439
6437
|
}
|
|
6440
6438
|
|
|
@@ -6443,7 +6441,7 @@ export interface OverwriteDataWithMandatoryType extends BaseOverwriteData {
|
|
|
6443
6441
|
}
|
|
6444
6442
|
|
|
6445
6443
|
export interface OverwriteDataWithOptionalType extends BaseOverwriteData {
|
|
6446
|
-
id: Exclude<
|
|
6444
|
+
id: Exclude<UserResolvable | RoleResolvable, Snowflake>;
|
|
6447
6445
|
}
|
|
6448
6446
|
|
|
6449
6447
|
export type OverwriteData = OverwriteDataWithMandatoryType | OverwriteDataWithOptionalType;
|
package/typings/index.d.ts
CHANGED
|
@@ -1463,7 +1463,7 @@ export class Guild extends AnonymousGuild {
|
|
|
1463
1463
|
): Promise<Guild>;
|
|
1464
1464
|
public setIcon(icon: BufferResolvable | Base64Resolvable | null, reason?: string): Promise<Guild>;
|
|
1465
1465
|
public setName(name: string, reason?: string): Promise<Guild>;
|
|
1466
|
-
public setOwner(owner:
|
|
1466
|
+
public setOwner(owner: UserResolvable, reason?: string): Promise<Guild>;
|
|
1467
1467
|
public setPreferredLocale(preferredLocale: Locale | null, reason?: string): Promise<Guild>;
|
|
1468
1468
|
public setPublicUpdatesChannel(publicUpdatesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
|
1469
1469
|
public setRulesChannel(rulesChannel: TextChannelResolvable | null, reason?: string): Promise<Guild>;
|
|
@@ -1564,7 +1564,7 @@ export abstract class GuildChannel extends BaseChannel {
|
|
|
1564
1564
|
public lockPermissions(): Promise<this>;
|
|
1565
1565
|
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
|
|
1566
1566
|
public permissionsFor(
|
|
1567
|
-
memberOrRole:
|
|
1567
|
+
memberOrRole: UserResolvable | RoleResolvable,
|
|
1568
1568
|
checkAdmin?: boolean,
|
|
1569
1569
|
): Readonly<PermissionsBitField> | null;
|
|
1570
1570
|
public setName(name: string, reason?: string): Promise<this>;
|
|
@@ -3321,7 +3321,7 @@ export class ThreadChannel<ThreadOnly extends boolean = boolean> extends BaseCha
|
|
|
3321
3321
|
public leave(): Promise<this>;
|
|
3322
3322
|
public permissionsFor(memberOrRole: GuildMember | Role, checkAdmin?: boolean): Readonly<PermissionsBitField>;
|
|
3323
3323
|
public permissionsFor(
|
|
3324
|
-
memberOrRole:
|
|
3324
|
+
memberOrRole: UserResolvable | RoleResolvable,
|
|
3325
3325
|
checkAdmin?: boolean,
|
|
3326
3326
|
): Readonly<PermissionsBitField> | null;
|
|
3327
3327
|
public fetchOwner(options?: FetchThreadOwnerOptions): Promise<ThreadMember>;
|
|
@@ -3913,14 +3913,13 @@ export class ApplicationCommandManager<
|
|
|
3913
3913
|
guildId: Snowflake,
|
|
3914
3914
|
): Promise<ApplicationCommand>;
|
|
3915
3915
|
public fetch(
|
|
3916
|
-
id: Snowflake,
|
|
3917
|
-
|
|
3916
|
+
options: Snowflake | (Omit<FetchApplicationCommandOptions, 'guildId'> & { id: Snowflake }),
|
|
3917
|
+
): Promise<ApplicationCommandScope>;
|
|
3918
|
+
public fetch(
|
|
3919
|
+
options: FetchApplicationCommandOptions & { id: Snowflake; guildId: Snowflake },
|
|
3918
3920
|
): Promise<ApplicationCommand>;
|
|
3919
|
-
public fetch(options: FetchApplicationCommandOptions): Promise<Collection<Snowflake, ApplicationCommandScope>>;
|
|
3920
|
-
public fetch(id: Snowflake, options?: FetchApplicationCommandOptions): Promise<ApplicationCommandScope>;
|
|
3921
3921
|
public fetch(
|
|
3922
|
-
|
|
3923
|
-
options?: FetchApplicationCommandOptions,
|
|
3922
|
+
options?: Omit<FetchApplicationCommandOptions, 'id'>,
|
|
3924
3923
|
): Promise<Collection<Snowflake, ApplicationCommandScope>>;
|
|
3925
3924
|
public set(
|
|
3926
3925
|
commands: readonly ApplicationCommandDataResolvable[],
|
|
@@ -4089,11 +4088,11 @@ export class GuildApplicationCommandManager extends ApplicationCommandManager<Ap
|
|
|
4089
4088
|
command: ApplicationCommandResolvable,
|
|
4090
4089
|
data: Partial<ApplicationCommandDataResolvable>,
|
|
4091
4090
|
): Promise<ApplicationCommand>;
|
|
4092
|
-
public fetch(id: Snowflake, options?: FetchGuildApplicationCommandFetchOptions): Promise<ApplicationCommand>;
|
|
4093
|
-
public fetch(options: FetchGuildApplicationCommandFetchOptions): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4094
4091
|
public fetch(
|
|
4095
|
-
id
|
|
4096
|
-
|
|
4092
|
+
options: Snowflake | (FetchGuildApplicationCommandFetchOptions & { id: Snowflake }),
|
|
4093
|
+
): Promise<ApplicationCommand>;
|
|
4094
|
+
public fetch(
|
|
4095
|
+
options?: Omit<FetchGuildApplicationCommandFetchOptions, 'id'>,
|
|
4097
4096
|
): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4098
4097
|
public set(commands: readonly ApplicationCommandDataResolvable[]): Promise<Collection<Snowflake, ApplicationCommand>>;
|
|
4099
4098
|
}
|
|
@@ -4177,12 +4176,12 @@ export class GuildManager extends CachedManager<Snowflake, Guild, GuildResolvabl
|
|
|
4177
4176
|
}
|
|
4178
4177
|
|
|
4179
4178
|
export interface AddOrRemoveGuildMemberRoleOptions {
|
|
4180
|
-
user:
|
|
4179
|
+
user: UserResolvable;
|
|
4181
4180
|
role: RoleResolvable;
|
|
4182
4181
|
reason?: string;
|
|
4183
4182
|
}
|
|
4184
4183
|
|
|
4185
|
-
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember,
|
|
4184
|
+
export class GuildMemberManager extends CachedManager<Snowflake, GuildMember, UserResolvable> {
|
|
4186
4185
|
private constructor(guild: Guild, iterable?: Iterable<RawGuildMemberData>);
|
|
4187
4186
|
public guild: Guild;
|
|
4188
4187
|
public get me(): GuildMember | null;
|
|
@@ -4474,7 +4473,7 @@ export class UserManager extends CachedManager<Snowflake, User, UserResolvable>
|
|
|
4474
4473
|
export class VoiceStateManager extends CachedManager<Snowflake, VoiceState, typeof VoiceState> {
|
|
4475
4474
|
private constructor(guild: Guild, iterable?: Iterable<RawVoiceStateData>);
|
|
4476
4475
|
public guild: Guild;
|
|
4477
|
-
public fetch(member:
|
|
4476
|
+
public fetch(member: UserResolvable | '@me', options?: BaseFetchOptions): Promise<VoiceState>;
|
|
4478
4477
|
}
|
|
4479
4478
|
|
|
4480
4479
|
//#endregion
|
|
@@ -5461,6 +5460,7 @@ export type EmojiIdentifierResolvable =
|
|
|
5461
5460
|
export type EmojiResolvable = Snowflake | GuildEmoji | ReactionEmoji | ApplicationEmoji;
|
|
5462
5461
|
|
|
5463
5462
|
export interface FetchApplicationCommandOptions extends BaseFetchOptions {
|
|
5463
|
+
id?: Snowflake;
|
|
5464
5464
|
guildId?: Snowflake;
|
|
5465
5465
|
locale?: Locale;
|
|
5466
5466
|
withLocalizations?: boolean;
|
|
@@ -5856,7 +5856,7 @@ export interface GuildEditOptions {
|
|
|
5856
5856
|
afkTimeout?: number;
|
|
5857
5857
|
afkChannel?: VoiceChannelResolvable | null;
|
|
5858
5858
|
icon?: BufferResolvable | Base64Resolvable | null;
|
|
5859
|
-
owner?:
|
|
5859
|
+
owner?: UserResolvable;
|
|
5860
5860
|
splash?: BufferResolvable | Base64Resolvable | null;
|
|
5861
5861
|
discoverySplash?: BufferResolvable | Base64Resolvable | null;
|
|
5862
5862
|
banner?: BufferResolvable | Base64Resolvable | null;
|
|
@@ -5911,8 +5911,6 @@ export interface GuildMemberEditOptions {
|
|
|
5911
5911
|
reason?: string;
|
|
5912
5912
|
}
|
|
5913
5913
|
|
|
5914
|
-
export type GuildMemberResolvable = GuildMember | UserResolvable;
|
|
5915
|
-
|
|
5916
5914
|
export type GuildResolvable = Guild | NonThreadGuildBasedChannel | GuildMember | GuildEmoji | Invite | Role | Snowflake;
|
|
5917
5915
|
|
|
5918
5916
|
export interface GuildPruneMembersOptions {
|
|
@@ -6434,7 +6432,7 @@ export interface MultipleShardSpawnOptions {
|
|
|
6434
6432
|
export interface BaseOverwriteData {
|
|
6435
6433
|
allow?: PermissionResolvable;
|
|
6436
6434
|
deny?: PermissionResolvable;
|
|
6437
|
-
id:
|
|
6435
|
+
id: UserResolvable | RoleResolvable;
|
|
6438
6436
|
type?: OverwriteType;
|
|
6439
6437
|
}
|
|
6440
6438
|
|
|
@@ -6443,7 +6441,7 @@ export interface OverwriteDataWithMandatoryType extends BaseOverwriteData {
|
|
|
6443
6441
|
}
|
|
6444
6442
|
|
|
6445
6443
|
export interface OverwriteDataWithOptionalType extends BaseOverwriteData {
|
|
6446
|
-
id: Exclude<
|
|
6444
|
+
id: Exclude<UserResolvable | RoleResolvable, Snowflake>;
|
|
6447
6445
|
}
|
|
6448
6446
|
|
|
6449
6447
|
export type OverwriteData = OverwriteDataWithMandatoryType | OverwriteDataWithOptionalType;
|
package/typings/index.test-d.ts
CHANGED
|
@@ -712,8 +712,8 @@ client.on('clientReady', async client => {
|
|
|
712
712
|
|
|
713
713
|
// Test command manager methods
|
|
714
714
|
const globalCommand = await client.application?.commands.fetch(globalCommandId);
|
|
715
|
-
const guildCommandFromGlobal = await client.application?.commands.fetch(guildCommandId,
|
|
716
|
-
const guildCommandFromGuild = await client.guilds.cache.get(testGuildId)?.commands.fetch(guildCommandId);
|
|
715
|
+
const guildCommandFromGlobal = await client.application?.commands.fetch({ id: guildCommandId, guildId: testGuildId });
|
|
716
|
+
const guildCommandFromGuild = await client.guilds.cache.get(testGuildId)?.commands.fetch({ id: guildCommandId });
|
|
717
717
|
|
|
718
718
|
await client.application?.commands.create(slashCommandBuilder);
|
|
719
719
|
await client.application?.commands.create(contextMenuCommandBuilder);
|
|
@@ -1589,9 +1589,9 @@ declare const autoModerationRuleManager: AutoModerationRuleManager;
|
|
|
1589
1589
|
}
|
|
1590
1590
|
|
|
1591
1591
|
declare const guildApplicationCommandManager: GuildApplicationCommandManager;
|
|
1592
|
-
expectType<Promise<Collection<Snowflake, ApplicationCommand>>>(guildApplicationCommandManager.fetch());
|
|
1593
|
-
expectType<Promise<Collection<Snowflake, ApplicationCommand>>>(guildApplicationCommandManager.fetch(undefined, {}));
|
|
1594
1592
|
expectType<Promise<ApplicationCommand>>(guildApplicationCommandManager.fetch('0'));
|
|
1593
|
+
expectType<Promise<ApplicationCommand>>(guildApplicationCommandManager.fetch({ id: '0' }));
|
|
1594
|
+
expectType<Promise<Collection<Snowflake, ApplicationCommand>>>(guildApplicationCommandManager.fetch());
|
|
1595
1595
|
|
|
1596
1596
|
declare const categoryChannelChildManager: CategoryChannelChildManager;
|
|
1597
1597
|
{
|