@wolfstar/plugin-gateway 0.14.0-next-20261009112235 → 0.14.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 +15 -2
- package/dist/esm/index.d.ts +40 -15
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +40 -15
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -8950,7 +8950,10 @@ function highestFirst(roles) {
|
|
|
8950
8950
|
* (`highest`, `hoist`, `color`, ...) are `Awaitable`, like `manager.cache.get`. They are synchronous with the default
|
|
8951
8951
|
* in-memory cache and a promise with a remote store, so `await` works with both.
|
|
8952
8952
|
*
|
|
8953
|
-
* They only know the roles the cache holds
|
|
8953
|
+
* They only know the roles the cache holds, and skip the ones it lacks without an error. With a filtered cache or a
|
|
8954
|
+
* `plugin-broker` worker that makes `highest` answer a lower role than the member's real one. Call
|
|
8955
|
+
* {@link GuildMemberRoleManager.fetch} first, or {@link GuildMemberRoleManager.fetchHighest}, where a hierarchy check
|
|
8956
|
+
* must not under-report. The other `fetch*` methods fall back to the API when a role is not cached.
|
|
8954
8957
|
*/
|
|
8955
8958
|
var GuildMemberRoleManager = class GuildMemberRoleManager extends BaseManager {
|
|
8956
8959
|
/**
|
|
@@ -8996,14 +8999,19 @@ var GuildMemberRoleManager = class GuildMemberRoleManager extends BaseManager {
|
|
|
8996
8999
|
return this.member.roleIds;
|
|
8997
9000
|
}
|
|
8998
9001
|
/**
|
|
8999
|
-
* The member's roles held in the cache, by ID, `@everyone` included. Roles that are not cached are skipped
|
|
9000
|
-
* {@link GuildMemberRoleManager.fetch} to get them all.
|
|
9002
|
+
* The member's roles held in the cache, by ID, `@everyone` included. Roles that are not cached are skipped, without
|
|
9003
|
+
* an error: use {@link GuildMemberRoleManager.fetch} to get them all.
|
|
9001
9004
|
*/
|
|
9002
9005
|
get cache() {
|
|
9003
9006
|
return cachedRoles(this.client, this.guildId, [...this.ids, this.guildId]);
|
|
9004
9007
|
}
|
|
9005
9008
|
/**
|
|
9006
9009
|
* The member's highest cached role. `null` when none of their roles is cached, `@everyone` included.
|
|
9010
|
+
*
|
|
9011
|
+
* @remarks
|
|
9012
|
+
* Roles missing from the cache are skipped, not an error: the answer is the highest role the cache holds, so a
|
|
9013
|
+
* hierarchy check can compare a higher-ranked member as a lower one. Use {@link GuildMemberRoleManager.fetchHighest}
|
|
9014
|
+
* for an answer that is right on a cache miss, or `await member.roles.fetch()` before reading this.
|
|
9007
9015
|
*/
|
|
9008
9016
|
get highest() {
|
|
9009
9017
|
return this.fromCache(pick.highest);
|
|
@@ -9053,9 +9061,10 @@ var GuildMemberRoleManager = class GuildMemberRoleManager extends BaseManager {
|
|
|
9053
9061
|
/**
|
|
9054
9062
|
* Fetches the member's highest role, `@everyone` when they have no other.
|
|
9055
9063
|
*
|
|
9056
|
-
* @
|
|
9057
|
-
*
|
|
9058
|
-
*
|
|
9064
|
+
* @remarks
|
|
9065
|
+
* The call for a role-hierarchy check that must be right on a cache miss: unlike
|
|
9066
|
+
* {@link GuildMemberRoleManager.highest}, it asks the API for the roles the cache lacks, so it never answers a lower
|
|
9067
|
+
* role than the member's real one. With a complete cache it makes no request.
|
|
9059
9068
|
*/
|
|
9060
9069
|
async fetchHighest() {
|
|
9061
9070
|
return pick.highest(await this.fetch());
|
|
@@ -9372,6 +9381,11 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9372
9381
|
* The member's guild-wide permissions, before channel overwrites, like discord.js's `GuildMember#permissions`:
|
|
9373
9382
|
* computed from the cached guild and roles, skipping the roles that are not cached.
|
|
9374
9383
|
*
|
|
9384
|
+
* @remarks
|
|
9385
|
+
* A role missing from the cache is skipped, not an error, so the answer can hold fewer permissions than the member
|
|
9386
|
+
* has. Use {@link GuildMember.fetchPermissions} for an answer that is right on a cache miss, or
|
|
9387
|
+
* `await member.roles.fetch()` before reading this.
|
|
9388
|
+
*
|
|
9375
9389
|
* @throws A `GatewayError`: `GuildUncached` when the guild is not cached.
|
|
9376
9390
|
*/
|
|
9377
9391
|
get permissions() {
|
|
@@ -9387,9 +9401,9 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9387
9401
|
* Fetches the member's guild-wide permissions, before channel overwrites: {@link GuildMember.permissions} with the
|
|
9388
9402
|
* guild and the roles fetched from the API when they are not cached, whatever the cache.
|
|
9389
9403
|
*
|
|
9390
|
-
* @
|
|
9391
|
-
*
|
|
9392
|
-
*
|
|
9404
|
+
* @remarks
|
|
9405
|
+
* The call for a permission check that must be right on a cache miss: the getter skips the roles the cache lacks
|
|
9406
|
+
* and can answer fewer permissions than the member has.
|
|
9393
9407
|
*/
|
|
9394
9408
|
async fetchPermissions() {
|
|
9395
9409
|
const guild = await this.client.guilds.fetch(this.guildId);
|
|
@@ -9406,10 +9420,11 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9406
9420
|
* Fetches the member's permissions in a channel: their guild permissions with the channel's overwrites applied.
|
|
9407
9421
|
* discord.js: `member.permissionsIn(channel)`.
|
|
9408
9422
|
*
|
|
9409
|
-
* @
|
|
9423
|
+
* @remarks
|
|
9424
|
+
* Like {@link GuildMember.fetchPermissions}, the call for a check that must be right on a cache miss: it also
|
|
9425
|
+
* fetches the channel and the roles when they are not cached.
|
|
9410
9426
|
*
|
|
9411
|
-
* @
|
|
9412
|
-
* fallback; fetch the channel too (`client.channels.fetch(channelId)`).
|
|
9427
|
+
* @param channel The channel, or its ID. Threads use their parent's overwrites.
|
|
9413
9428
|
*/
|
|
9414
9429
|
fetchPermissionsIn(channel) {
|
|
9415
9430
|
return computePermissionsIn(channel, this);
|
|
@@ -9419,6 +9434,10 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9419
9434
|
* with the channel's overwrites applied, read from the cache.
|
|
9420
9435
|
*
|
|
9421
9436
|
* @param channel The channel, or the ID of a cached one. Threads use their parent's overwrites.
|
|
9437
|
+
* @remarks
|
|
9438
|
+
* A role missing from the cache is skipped, as in {@link GuildMember.permissions}: use
|
|
9439
|
+
* {@link GuildMember.fetchPermissionsIn} for an answer that is right on a cache miss.
|
|
9440
|
+
*
|
|
9422
9441
|
* @throws A `GatewayError`: `ChannelUncached` or `GuildUncached` when they are not cached.
|
|
9423
9442
|
*/
|
|
9424
9443
|
permissionsIn(channel) {
|
|
@@ -9499,6 +9518,11 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9499
9518
|
* Whether the bot ranks above the member, like discord.js's `GuildMember#manageable`: it is not the guild owner, not
|
|
9500
9519
|
* the bot itself, and the bot's highest role is higher than theirs (or the bot owns the guild).
|
|
9501
9520
|
*
|
|
9521
|
+
* @remarks
|
|
9522
|
+
* It reads {@link GuildMemberRoleManager.highest}, which skips the roles missing from the cache: a higher role that
|
|
9523
|
+
* is not cached makes the member look lower. Call `await member.roles.fetch()` and `await me.roles.fetch()` before
|
|
9524
|
+
* reading this, or compare {@link GuildMemberRoleManager.fetchHighest} of both.
|
|
9525
|
+
*
|
|
9502
9526
|
* @throws A `GatewayError`: `GuildUncached` or `GuildUncachedMe` when the guild or the bot's member is
|
|
9503
9527
|
* not cached.
|
|
9504
9528
|
*/
|
|
@@ -9529,21 +9553,22 @@ var GuildMember = class GuildMember extends Structure {
|
|
|
9529
9553
|
}
|
|
9530
9554
|
/**
|
|
9531
9555
|
* Whether the bot can kick the member, like discord.js's `GuildMember#kickable`: it outranks them and has
|
|
9532
|
-
* `KickMembers`. It throws like {@link GuildMember.manageable}.
|
|
9556
|
+
* `KickMembers`. It throws, and skips uncached roles, like {@link GuildMember.manageable}.
|
|
9533
9557
|
*/
|
|
9534
9558
|
get kickable() {
|
|
9535
9559
|
return cacheRead(this.managedWithCached("KickMembers"));
|
|
9536
9560
|
}
|
|
9537
9561
|
/**
|
|
9538
9562
|
* Whether the bot can ban the member, like discord.js's `GuildMember#bannable`: it outranks them and has
|
|
9539
|
-
* `BanMembers`. It throws like {@link GuildMember.manageable}.
|
|
9563
|
+
* `BanMembers`. It throws, and skips uncached roles, like {@link GuildMember.manageable}.
|
|
9540
9564
|
*/
|
|
9541
9565
|
get bannable() {
|
|
9542
9566
|
return cacheRead(this.managedWithCached("BanMembers"));
|
|
9543
9567
|
}
|
|
9544
9568
|
/**
|
|
9545
9569
|
* Whether the bot can time the member out, like discord.js's `GuildMember#moderatable`: it outranks them, has
|
|
9546
|
-
* `ModerateMembers`, and they are no administrator. It throws
|
|
9570
|
+
* `ModerateMembers`, and they are no administrator. It throws, and skips uncached roles, like
|
|
9571
|
+
* {@link GuildMember.manageable}.
|
|
9547
9572
|
*/
|
|
9548
9573
|
get moderatable() {
|
|
9549
9574
|
return cacheRead(whenAll([this.managedWithCached("ModerateMembers")], ([managed]) => managed ? whenAll([this.permissions], ([permissions]) => !permissions.has("Administrator")) : false));
|