Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat(Client): add guildAvailable event (#9692)
Co-authored-by: Kyranet <kyradiscord@gmail.com>
  • Loading branch information
2 people authored and vladfrangu committed Nov 5, 2023
1 parent 2ac8be0 commit 67dd30a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/client/websocket/handlers/GUILD_CREATE.js
Expand Up @@ -8,6 +8,13 @@ module.exports = (client, { d: data }, shard) => {
if (!guild.available && !data.unavailable) {
// A newly available guild
guild._patch(data);

/**
* Emitted whenever a guild becomes available.
* @event Client#guildAvailable
* @param {Guild} guild The guild that became available
*/
client.emit(Events.GUILD_AVAILABLE, guild);
}
} else {
// A new guild
Expand Down
2 changes: 2 additions & 0 deletions src/util/Constants.js
Expand Up @@ -183,6 +183,7 @@ exports.Opcodes = {
* * AUTO_MODERATION_RULE_CREATE: autoModerationRuleCreate
* * AUTO_MODERATION_RULE_DELETE: autoModerationRuleDelete
* * AUTO_MODERATION_RULE_UPDATE: autoModerationRuleUpdate
* * GUILD_AVAILABLE: guildAvailable
* * GUILD_CREATE: guildCreate
* * GUILD_DELETE: guildDelete
* * GUILD_UPDATE: guildUpdate
Expand Down Expand Up @@ -267,6 +268,7 @@ exports.Events = {
AUTO_MODERATION_RULE_CREATE: 'autoModerationRuleCreate',
AUTO_MODERATION_RULE_DELETE: 'autoModerationRuleDelete',
AUTO_MODERATION_RULE_UPDATE: 'autoModerationRuleUpdate',
GUILD_AVAILABLE: 'guildAvailable',
GUILD_CREATE: 'guildCreate',
GUILD_DELETE: 'guildDelete',
GUILD_UPDATE: 'guildUpdate',
Expand Down
2 changes: 2 additions & 0 deletions typings/index.d.ts
Expand Up @@ -4604,6 +4604,7 @@ export interface ClientEvents extends BaseClientEvents {
emojiDelete: [emoji: GuildEmoji];
emojiUpdate: [oldEmoji: GuildEmoji, newEmoji: GuildEmoji];
error: [error: Error];
guildAvailable: [guild: Guild];
guildBanAdd: [ban: GuildBan];
guildBanRemove: [ban: GuildBan];
guildCreate: [guild: Guild];
Expand Down Expand Up @@ -4870,6 +4871,7 @@ export interface ConstantsEvents {
AUTO_MODERATION_RULE_CREATE: 'autoModerationRuleCreate';
AUTO_MODERATION_RULE_DELETE: 'autoModerationRuleDelete';
AUTO_MODERATION_RULE_UPDATE: 'autoModerationRuleUpdate';
GUILD_AVAILABLE: 'guildAvailable';
GUILD_CREATE: 'guildCreate';
GUILD_DELETE: 'guildDelete';
GUILD_UPDATE: 'guildUpdate';
Expand Down

0 comments on commit 67dd30a

Please sign in to comment.