feat: Add not_found to guild member chunk data (#8975)

* feat: add `not_found` to chunk data

* docs: consistency

* types: export `JSONValue`

* refactor: move into typedef area

* refactor: prefer unknown

* docs: fix parsing

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Jiralite
2023-01-02 11:55:06 +00:00
committed by GitHub
parent 876b181312
commit be294eaf99
2 changed files with 5 additions and 2 deletions

View File

@@ -18,6 +18,8 @@ module.exports = (client, { d: data }) => {
* @typedef {Object} GuildMembersChunk * @typedef {Object} GuildMembersChunk
* @property {number} index Index of the received chunk * @property {number} index Index of the received chunk
* @property {number} count Number of chunks the client should receive * @property {number} count Number of chunks the client should receive
* @property {Array<*>} notFound An array of whatever could not be found
* when using {@link GatewayOpcodes.RequestGuildMembers}
* @property {?string} nonce Nonce for this chunk * @property {?string} nonce Nonce for this chunk
*/ */
@@ -29,8 +31,9 @@ module.exports = (client, { d: data }) => {
* @param {GuildMembersChunk} chunk Properties of the received chunk * @param {GuildMembersChunk} chunk Properties of the received chunk
*/ */
client.emit(Events.GuildMembersChunk, members, guild, { client.emit(Events.GuildMembersChunk, members, guild, {
count: data.chunk_count,
index: data.chunk_index, index: data.chunk_index,
count: data.chunk_count,
notFound: data.not_found,
nonce: data.nonce, nonce: data.nonce,
}); });
}; };

View File

@@ -4711,7 +4711,7 @@ export interface ClientEvents {
guildMembersChunk: [ guildMembersChunk: [
members: Collection<Snowflake, GuildMember>, members: Collection<Snowflake, GuildMember>,
guild: Guild, guild: Guild,
data: { count: number; index: number; nonce: string | undefined }, data: { index: number; count: number; notFound: unknown[]; nonce: string | undefined },
]; ];
guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember]; guildMemberUpdate: [oldMember: GuildMember | PartialGuildMember, newMember: GuildMember];
guildUpdate: [oldGuild: Guild, newGuild: Guild]; guildUpdate: [oldGuild: Guild, newGuild: Guild];