diff --git a/packages/plugin-moreevents/README.md b/packages/plugin-moreevents/README.md index 9018a0e..84da648 100644 --- a/packages/plugin-moreevents/README.md +++ b/packages/plugin-moreevents/README.md @@ -40,12 +40,20 @@ Now when you create a listener, more events will show up. List of events: - selectMenu - clickButton +- autocomplete +- applicationCommand +- messageContextMenuCommand +- userContextMenuCommand +- guildLargeUpdate - guildBoostLevelUp - guildBoostLevelDown -- guildRegionUpdate - guildBannerUpdate - guildAfkChannelUpdate +- guildModeratorNewsChannelUpdate +- guildRulesChannelUpdate +- guildSystemChannelUpdate +- guildSystemEventsUpdate - guildVanityURLUpdate - guildFeaturesUpdate - guildAcronymUpdate @@ -53,6 +61,28 @@ List of events: - guildMaximumMembersUpdate - guildPartnerUpdate - guildVerifyUpdate +- guildNameUpdate +- guildIconUpdate +- guildDiscoverySplashUpdate +- guildSplashUpdate +- guildDescriptionUpdate +- guildDefaultMessageNotificationsUpdate +- guildExplicitContentFilterUpdate +- guildMaximumMembersIncreased +- guildMaximumMembersDecreased +- guildMaxVideoChannelUsersIncreased +- guildMaxVideoChannelUsersDecreased +- guildMFAProtectionDisabled +- guildMFAProtectionEnabled +- guildNSFWLevelDecreased +- guildNSFWLevelIncreased +- guildVerificationLevelIncreased +- guildVerificationLevelDecreased +- guildLocaleUpdate +- guildBoostProgressBarUpdate +- guildShardUpdate +- guildWidgetUpdate +- guildWidgetChannelUpdate - threadStateUpdate - threadNameUpdate @@ -69,11 +99,19 @@ List of events: - voiceChannelUndeaf - voiceStreamingStart - voiceStreamingStop +- voiceCameraDisabled +- voiceCameraEnabled -- guildMemberNicknameUpdate -- guildMemberAcceptShipScreening - guildMemberBoost - guildMemberUnboost +- guildMemberNicknameUpdate +- guildMemberTimeoutAdded +- guildMemberTimeoutRemoved +- guildMemberTimeoutUpdate +- guildMemberAcceptShipScreening +- guildMemberRoleUpdate +- guildMemberGuildAvatarUpdate +- guildMemebrFlagsUpdate - userAvatarUpdate - userUsernameUpdate @@ -83,3 +121,10 @@ List of events: - rolePositionUpdate - rolePermissionsUpdate +- roleColorUpdate +- roleEditUpdate +- roleHoistUpdate +- roleIconUpdate +- roleManageUpdate +- roleMentionUpdate +- roleNameUpdate diff --git a/packages/plugin-moreevents/src/index.ts b/packages/plugin-moreevents/src/index.ts index 7d32b4d..62a092b 100644 --- a/packages/plugin-moreevents/src/index.ts +++ b/packages/plugin-moreevents/src/index.ts @@ -8,12 +8,20 @@ declare module 'discord.js' { interface ClientEvents { selectMenu: [SelectMenuInteraction]; clickButton: [ButtonInteraction]; + autocomplete: [AutocompleteInteraction]; + applicationCommand: [ChatInputCommandInteraction]; + messageContextMenuCommand: [MessageContextMenuCommandInteraction]; + userContextMenuCommand: [UserContextMenuCommandInteraction]; + guildLargeUpdate: [Guild, boolean, boolean]; guildBoostLevelUp: [Guild, string, string]; guildBoostLevelDown: [Guild, string, string]; - guildRegionUpdate: [Guild, string, string]; guildBannerUpdate: [Guild, string, string]; - guildAfkChannelUpdate: [Guild, Channel, Channel]; + guildAfkChannelUpdate: [Guild, GuildChannel, GuildChannel]; + guildModeratorNewsChannelUpdate: [Guild, GuildChannel, GuildChannel]; + guildRulesChannelUpdate: [Guild, GuildChannel, GuildChannel]; + guildSystemChannelUpdate: [Guild, GuildChannel, GuildChannel]; + guildSystemEventsUpdate: [Guild, Readonly, Readonly]; guildVanityURLUpdate: [Guild, string, string]; guildFeaturesUpdate: [Guild, object, object]; guildAcronymUpdate: [Guild, string, string]; @@ -21,7 +29,29 @@ declare module 'discord.js' { guildMaximumMembersUpdate: [Guild, number, number]; guildPartnerUpdate: [Guild, boolean, boolean]; guildVerifyUpdate: [Guild, boolean, boolean]; - + guildNameUpdate: [Guild, string, string]; + guildIconUpdate: [Guild, Guild]; + guildDiscoverySplashUpdate: [Guild, Guild]; + guildSplashUpdate: [Guild, Guild]; + guildDescriptionUpdate: [Guild, string, string]; + guildDefaultMessageNotificationsUpdate: [Guild, GuildDefaultMessageNotifications, GuildDefaultMessageNotifications]; + guildExplicitContentFilterUpdate: [Guild, GuildExplicitContentFilter, GuildExplicitContentFilter]; + guildMaximumMembersIncreased: [Guild, number, number]; + guildMaximumMembersDecreased: [Guild, number, number]; + guildMaxVideoChannelUsersIncreased: [Guild, number, number]; + guildMaxVideoChannelUsersDecreased: [Guild, number, number]; + guildMFAProtectionDisabled: [Guild, GuildMFALevel, GuildMFALevel]; + guildMFAProtectionEnabled: [Guild, GuildMFALevel, GuildMFALevel]; + guildNSFWLevelDecreased: [Guild, GuildNSFWLevel, GuildNSFWLevel]; + guildNSFWLevelIncreased: [Guild, GuildNSFWLevel, GuildNSFWLevel]; + guildVerificationLevelIncreased: [Guild, GuildVerificationLevel, GuildVerificationLevel]; + guildVerificationLevelDecreased: [Guild, GuildVerificationLevel, GuildVerificationLevel]; + guildLocaleUpdate: [Guild, Locale, Locale]; + guildBoostProgressBarUpdate: [Guild, boolean, boolean]; + guildShardUpdate: [Guild, WebSocketShard, WebSocketShard]; + guildWidgetUpdate: [Guild, boolean, boolean]; + guildWidgetChannelUpdate: [Guild, GuildChannel, GuildChannel]; + threadStateUpdate: [ThreadChannel, ThreadChannel]; threadNameUpdate: [ThreadChannel, string, string]; threadLockStateUpdate: [ThreadChannel, ThreadChannel]; @@ -41,14 +71,19 @@ declare module 'discord.js' { voiceChannelUndeaf: [GuildMember, VoiceChannelDeafType]; voiceStreamingStart: [GuildMember, VoiceBasedChannel]; voiceStreamingStop: [GuildMember, VoiceBasedChannel]; - - guildMemberNicknameUpdate: [GuildMember, string, string]; - guildMemberAcceptShipScreening: [GuildMember]; + voiceCameraDisabled: [GuildMember, VoiceBasedChannel]; + voiceCameraEnabled: [GuildMember, VoiceBasedChannel]; + guildMemberBoost: [GuildMember, Date, Date]; guildMemberUnboost: [GuildMember, Date, Date]; + guildMemberNicknameUpdate: [GuildMember, string, string]; guildMemberTimeoutAdded: [GuildMember, Date, Date]; - guildMemberTimeoutChanged: [GuildMember, Date, Date]; guildMemberTimeoutRemoved: [GuildMember, Date, Date]; + guildMemberTimeoutUpdate: [GuildMember, Date, Date]; + guildMemberAcceptShipScreening: [GuildMember]; + guildMemberRoleUpdate: [GuildMember, GuildMemberRoleManager, GuildMemberRoleManager]; + guildMemberGuildAvatarUpdate: [GuildMember, string, string]; + guildMemberFlagsUpdate: [GuildMember, Readonly, Readonly]; userAvatarUpdate: [User, string, string]; userUsernameUpdate: [User, string, string]; @@ -58,6 +93,13 @@ declare module 'discord.js' { rolePositionUpdate: [Role, number, number]; rolePermissionsUpdate: [Role, bigint, bigint]; + roleColorUpdate: [Role, string, string]; + roleEditUpdate: [Role, boolean, boolean]; + roleHoistUpdate: [Role, boolean, boolean]; + roleIconUpdate: [Role, string, string]; + roleManageUpdate: [Role, boolean, boolean]; + roleMentionUpdate: [Role, boolean, boolean]; + roleNameUpdate: [Role, string, string]; } } diff --git a/packages/plugin-moreevents/src/listeners/channel_update.ts b/packages/plugin-moreevents/src/listeners/channel_update.ts index 7de2da5..5955385 100644 --- a/packages/plugin-moreevents/src/listeners/channel_update.ts +++ b/packages/plugin-moreevents/src/listeners/channel_update.ts @@ -10,41 +10,32 @@ new Listener({ const guildOldChannel = oldChannel as GuildChannel; const guildNewChannel = newChannel as GuildChannel; - if ( - guildOldChannel.permissionOverwrites !== - guildOldChannel.permissionOverwrites - ) { + + + if (!guildOldChannel.permissionOverwrites.cache.equals(guildOldChannel.permissionOverwrites.cache)) { client.emit( 'guildChannelPermissionsUpdate', newChannel, guildOldChannel.permissionOverwrites, - guildNewChannel.permissionOverwrites, + guildNewChannel.permissionOverwrites ); } - if ( - guildOldChannel.type === 'GUILD_TEXT' && - (guildOldChannel as TextChannel).topic !== - (guildNewChannel as TextChannel).topic - ) { + if (guildOldChannel.type === 0 && (guildOldChannel as TextChannel).topic !== (guildNewChannel as TextChannel).topic) { client.emit( 'guildChannelTopicUpdate', newChannel, (guildOldChannel as TextChannel).topic, - (guildNewChannel as TextChannel).topic, + (guildNewChannel as TextChannel).topic ); } - if ( - guildOldChannel.type === 'GUILD_TEXT' && - (guildOldChannel as TextChannel).nsfw !== - (guildNewChannel as TextChannel).nsfw - ) { + if (guildOldChannel.type === 0 && (guildOldChannel as TextChannel).nsfw !== (guildNewChannel as TextChannel).nsfw) { client.emit( 'guildChannelNSFWUpdate', newChannel, (guildOldChannel as TextChannel).nsfw, - (guildNewChannel as TextChannel).nsfw, + (guildNewChannel as TextChannel).nsfw ); } @@ -53,34 +44,71 @@ new Listener({ 'guildChannelTypeUpdate', newChannel, oldChannel.type, - newChannel.type, + newChannel.type ); } - if ( - guildOldChannel.type === 'GUILD_VOICE' && - (guildOldChannel as VoiceChannel).userLimit !== - (guildNewChannel as VoiceChannel).userLimit - ) { + if (guildOldChannel.type === 2 && (guildOldChannel as VoiceChannel).userLimit !== (guildNewChannel as VoiceChannel).userLimit) { client.emit( 'guildChannelUserLimitUpdate', newChannel, (guildOldChannel as VoiceChannel).userLimit, - (guildNewChannel as VoiceChannel).userLimit, + (guildNewChannel as VoiceChannel).userLimit ); } - if ( - guildOldChannel.type === 'GUILD_VOICE' && - (guildOldChannel as VoiceChannel).bitrate !== - (guildNewChannel as VoiceChannel).bitrate - ) { + if (guildOldChannel.type === 2 && (guildOldChannel as VoiceChannel).bitrate !== (guildNewChannel as VoiceChannel).bitrate) { client.emit( 'guildChannelBitrateUpdate', newChannel, (guildOldChannel as VoiceChannel).bitrate, - (guildNewChannel as VoiceChannel).bitrate, + (guildNewChannel as VoiceChannel).bitrate + ); + } + + if (guildOldChannel.name !== guildNewChannel.name) { + client.emit( + 'guildChannelNameUpdate', + newChannel, + guildOldChannel.name, + guildNewChannel.name + ); + } + + if (guildOldChannel.parentId !== guildNewChannel.parentId) { + client.emit( + 'guildChannelCategoryUpdate', + newChannel, + guildOldChannel.parent, + guildNewChannel.parent + ); + } + + if (guildOldChannel.permissionsLocked !== guildNewChannel.permissionLocked) { + client.emit( + 'guildChannelSynchronizationUpdate', + newChannel, + guildOldChannel.permissionsLocked, + guildNewChannel.permissionsLocked + ); + } + + if (guildOldChannel.position !== guildNewChannel.position) { + client.emit( + 'guildChannelPositionUpdate', + newChannel, + guildOldChannel.position, + guildNewChannel.position + ); + } + + if (guildOldChannel.rawPosition !== guildNewChannel.rawPosition) { + client.emit( + 'guildChannelRawPositionUpdate', + newChannel, + guildOldChannel.rawPosition, + guildNewChannel.rawPosition ); } - }, + } }); diff --git a/packages/plugin-moreevents/src/listeners/guild_member.ts b/packages/plugin-moreevents/src/listeners/guild_member.ts index bba08aa..994ab17 100644 --- a/packages/plugin-moreevents/src/listeners/guild_member.ts +++ b/packages/plugin-moreevents/src/listeners/guild_member.ts @@ -6,12 +6,12 @@ new Listener({ run: (oldMember, newMember) => { const client = oldMember.client; - if (newMember.premiumSince) { + if (!oldMember.premiumSince && newMember.premiumSince) { client.emit( 'guildMemberBoost', newMember, oldMember.premiumSince, - newMember.premiumSince, + newMember.premiumSince ); } @@ -20,7 +20,7 @@ new Listener({ 'guildMemberUnboost', newMember, oldMember.premiumSince, - newMember.premiumSince, + newMember.premiumSince ); } @@ -29,49 +29,66 @@ new Listener({ 'guildMemberNicknameUpdate', newMember, oldMember.nickname, - newMember.nickname, + newMember.nickname ); } - if ( - !oldMember.isCommunicationDisabled() && - newMember.isCommunicationDisabled() - ) { + if (!oldMember.isCommunicationDisabled() && newMember.isCommunicationDisabled()) { client.emit( 'guildMemberTimeoutAdded', newMember, oldMember.communicationDisabledUntil, - newMember.communicationDisabledUntil, + newMember.communicationDisabledUntil ); } - if ( - oldMember.isCommunicationDisabled() && - !newMember.isCommunicationDisabled() - ) { + if (oldMember.isCommunicationDisabled() && !newMember.isCommunicationDisabled()) { client.emit( 'guildMemberTimeoutRemoved', newMember, oldMember.communicationDisabledUntil, - null, + null ); } - if ( - oldMember.isCommunicationDisabled() && - oldMember.communicationDisabledUntilTimestamp !== - newMember.communicationDisabledUntilTimestamp - ) { + if (oldMember.isCommunicationDisabled() && oldMember.communicationDisabledUntilTimestamp !== newMember.communicationDisabledUntilTimestamp) { client.emit( - 'guildMemberTimeoutChanged', + 'guildMemberTimeoutUpdate', newMember, oldMember.communicationDisabledUntil, - newMember.communicationDisabledUntil, + newMember.communicationDisabledUntil ); } if (newMember.pending === false) { client.emit('guildMemberAcceptShipScreening', newMember); } + + if (!oldMember.roles.cache.equals(newMember.roles.cache)) { + client.emit( + 'guildMemberRoleUpdate', + newMember, + oldMember.roles, + newMember.roles + ); + } + + if (oldMember.avatar !== newMember.avatar && newMember.avatar !== newMember.user.avatar) { + client.emit( + 'guildMemberGuildAvatarUpdate', + newMember, + oldMember.avatar, + newMember.avatar + ); + } + + if (oldMember.flags.bits !== newMember.flags.bits) { + client.emit( + 'guildMemberFlagsUpdate', + newMember, + oldMember.flags, + newMember.flags + ); + } }, }); diff --git a/packages/plugin-moreevents/src/listeners/guild_update.ts b/packages/plugin-moreevents/src/listeners/guild_update.ts index ee05fba..0e4f613 100644 --- a/packages/plugin-moreevents/src/listeners/guild_update.ts +++ b/packages/plugin-moreevents/src/listeners/guild_update.ts @@ -6,12 +6,21 @@ new Listener({ run: (oldGuild, newGuild) => { const client = oldGuild.client; + if (oldGuild.large !== newGuild.large) { + client.emit( + 'guildLargeUpdate', + newGuild, + oldGuild.large, + newGuild.large + ); + } + if (oldGuild.premiumTier < newGuild.premiumTier) { client.emit( 'guildBoostLevelUp', newGuild, oldGuild.premiumTier, - newGuild.premiumTier, + newGuild.premiumTier ); } @@ -20,7 +29,7 @@ new Listener({ 'guildBoostLevelDown', newGuild, oldGuild.premiumTier, - newGuild.premiumTier, + newGuild.premiumTier ); } @@ -29,16 +38,52 @@ new Listener({ 'guildBannerUpdate', newGuild, oldGuild.banner, - newGuild.banner, + newGuild.banner ); } - if (oldGuild.afkChannel !== newGuild.afkChannel) { + if (oldGuild.afkChannelId !== newGuild.afkChannelId) { client.emit( 'guildAfkChannelUpdate', newGuild, oldGuild.afkChannel, - newGuild.afkChannel, + newGuild.afkChannel + ); + } + + if (oldGuild.publicUpdatesChannelId !== newGuild.publicUpdatesChannelId) { + client.emit( + 'guildModeratorNewsChannelUpdate', + newGuild, + oldGuild.publicUpdatesChannel, + newGuild.publicUpdatesChannel + ); + } + + if (oldGuild.rulesChannelId !== newGuild.rulesChannelId) { + client.emit( + 'guildRulesChannelUpdate', + newGuild, + oldGuild.rulesChannel, + newGuild.rulesChannel + ); + } + + if (oldGuild.systemChannelId !== newGuild.systemChannelId) { + client.emit( + 'guildSystemChannelUpdate', + newGuild, + oldGuild.systemChannel, + newGuild.systemChannel + ); + } + + if (oldGuild.systemChannelFlags.bits !== newGuild.systemChannelFlags.bits) { + client.emit( + 'guildSystemEventsUpdate', + newGuild, + oldGuild.systemChannelFlags, + newGuild.systemChannelFlags ); } @@ -47,7 +92,7 @@ new Listener({ 'guildVanityURLUpdate', newGuild, oldGuild.vanityURLCode, - newGuild.vanityURLCode, + newGuild.vanityURLCode ); } @@ -56,7 +101,7 @@ new Listener({ 'guildFeaturesUpdate', newGuild, oldGuild.features, - newGuild.features, + newGuild.features ); } @@ -65,7 +110,7 @@ new Listener({ 'guildAcronymUpdate', newGuild, oldGuild.nameAcronym, - newGuild.nameAcronym, + newGuild.nameAcronym ); } @@ -74,7 +119,7 @@ new Listener({ 'guildOwnerUpdate', newGuild, oldGuild.ownerId, - newGuild.ownerId, + newGuild.ownerId ); } @@ -83,7 +128,7 @@ new Listener({ 'guildMaximumMembersUpdate', newGuild, oldGuild.maximumMembers, - newGuild.maximumMembers, + newGuild.maximumMembers ); } @@ -92,7 +137,7 @@ new Listener({ 'guildPartnerUpdate', newGuild, oldGuild.partnered, - newGuild.partnered, + newGuild.partnered ); } @@ -101,7 +146,202 @@ new Listener({ 'guildVerifyUpdate', newGuild, oldGuild.verified, - newGuild.verified, + newGuild.verified + ); + } + + if (oldGuild.name !== newGuild.name) { + client.emit( + 'guildNameUpdate', + newGuild, + oldGuild.name, + newGuild.name + ); + } + + if (oldGuild.icon !== newGuild.icon) { + client.emit( + 'guildIconUpdate', + newGuild, + oldGuild + ); + } + + if (oldGuild.discoverySplash !== newGuild.discoverySplash) { + client.emit( + 'guildDiscoverySplashUpdate', + newGuild, + oldGuild + ); + } + + if (oldGuild.splash !== newGuild.splash) { + client.emit( + 'guildSplashUpdate', + newGuild, + oldGuild + ); + } + + if (oldGuild.description !== newGuild.description) { + client.emit( + 'guildDescriptionUpdate', + newGuild, + oldGuild.description, + newGuild.description + ); + } + + if (oldGuild.defaultMessageNotifications !== newGuild.defaultMessageNotifications) { + client.emit( + 'guildDefaultMessageNotificationsUpdate', + newGuild, + oldGuild.defaultMessageNotifications, + newGuild.defaultMessageNotifications + ); + } + + if (oldGuild.explicitContentFilter !== newGuild.explicitContentFilter) { + client.emit( + 'guildExplicitContentFilterUpdate', + newGuild, + oldGuild.explicitContentFilter, + newGuild.explicitContentFilter + ); + } + + if (oldGuild.maximumMembers > newGuild.maximumMembers) { + client.emit( + 'guildMaximumMembersIncreased', + newGuild, + oldGuild.maximumMembers, + newGuild.maximumMembers + ); + } + + if (oldGuild.maximumMembers < newGuild.maximumMembers) { + client.emit( + 'guildMaximumMembersDecreased', + newGuild, + oldGuild.maximumMembers, + newGuild.maximumMembers + ); + } + + if (oldGuild.maxVideoChannelUsers > newGuild.maxVideoChannelUsers) { + client.emit( + 'guildMaxVideoChannelUsersIncreased', + newGuild, + oldGuild.maxVideoChannelUsers, + newGuild.maxVideoChannelUsers + ); + } + + if (oldGuild.maxVideoChannelUsers < newGuild.maxVideoChannelUsers) { + client.emit( + 'guildMaxVideoChannelUsersDecreased', + newGuild, + oldGuild.maxVideoChannelUsers, + newGuild.maxVideoChannelUsers + ); + } + + if (oldGuild.mfaLevel > newGuild.mfaLevel) { + client.emit( + 'guildMFAProtectionDisabled', + newGuild, + oldGuild.mfaLevel, + newGuild.mfaLevel + ); + } + + if (oldGuild.mfaLevel < newGuild.mfaLevel) { + client.emit( + 'guildMFAProtectionEnabled', + newGuild, + oldGuild.mfaLevel, + newGuild.mfaLevel + ); + } + + if (oldGuild.nsfwLevel > newGuild.nsfwLevel) { + client.emit( + 'guildNSFWLevelDecreased', + newGuild, + oldGuild.nsfwLevel, + newGuild.nsfwLevel + ); + } + + if (oldGuild.nsfwLevel < oldGuild.nsfwLevel) { + client.emit( + 'guildNSFWLevelIncreased', + newGuild, + oldGuild.nsfwLevel, + newGuild.nsfwLevel + ); + } + + if (oldGuild.verificationLevel > newGuild.verificationLevel) { + client.emit( + 'guildVerificationLevelIncreased', + newGuild, + oldGuild.verificationLevel, + newGuild.verificationLevel + ); + } + + if (oldGuild.verificationLevel < newGuild.verificationLevel) { + client.emit( + 'guildVerificationLevelDecreased', + newGuild, + oldGuild.verificationLevel, + newGuild.verificationLevel + ); + } + + if (oldGuild.preferredLocale !== newGuild.preferredLocale) { + client.emit( + 'guildLocaleUpdate', + newGuild, + oldGuild.preferredLocale, + newGuild.preferredLocale + ); + } + + if (oldGuild.premiumProgressBarEnabled !== newGuild.premiumProgressBarEnabled) { + client.emit( + 'guildBoostProgressBarUpdate', + newGuild, + oldGuild.premiumProgressBarEnabled, + newGuild.premiumProgressBarEnabled + ); + } + + if (oldGuild.shardId !== newGuild.shardId) { + client.emit( + 'guildShardUpdate', + newGuild, + oldGuild.shard, + newGuild.shard + ); + } + + if (oldGuild.widgetEnabled !== newGuild.widgetEnabled) { + client.emit( + 'guildWidgetUpdate', + newGuild, + oldGuild.widgetEnabled, + newGuild.widgetEnabled + ); + } + + if (oldGuild.widgetChannelId !== newGuild.widgetChannelId) { + client.emit( + 'guildWidgetChannelUpdate', + newGuild, + oldGuild.widgetChannel, + newGuild.widgetChannel ); } }, diff --git a/packages/plugin-moreevents/src/listeners/interactions.ts b/packages/plugin-moreevents/src/listeners/interactions.ts index e6af1ea..c4e6d7c 100644 --- a/packages/plugin-moreevents/src/listeners/interactions.ts +++ b/packages/plugin-moreevents/src/listeners/interactions.ts @@ -8,10 +8,16 @@ new Listener({ if (interaction.isButton()) { client.emit('clickButton', interaction); - } else if (interaction.isSelectMenu()) { + } else if (interaction.isAnySelectMenu()) { client.emit('selectMenu', interaction); } else if (interaction.isAutocomplete()) { client.emit('autocomplete', interaction); + } else if (interaction.isChatInputCommand()) { + client.emit('applicationCommand', interaction); + } else if (interaction.isMessageContextMenuCommand()) { + client.emit('messageContextMenuCommand', interaction); + } else if (interaction.isUserContextMenuCommand()) { + client.emit('userContextMenuCommand', interaction); } }, }); diff --git a/packages/plugin-moreevents/src/listeners/role_update.ts b/packages/plugin-moreevents/src/listeners/role_update.ts index 5e10cf5..b93efdd 100644 --- a/packages/plugin-moreevents/src/listeners/role_update.ts +++ b/packages/plugin-moreevents/src/listeners/role_update.ts @@ -11,7 +11,7 @@ new Listener({ 'rolePositionUpdate', newRole, oldRole.rawPosition, - newRole.rawPosition, + newRole.rawPosition ); } @@ -20,8 +20,71 @@ new Listener({ 'rolePermissionsUpdate', newRole, oldRole.permissions.bitfield, - newRole.permissions.bitfield, + newRole.permissions.bitfield ); } - }, + + if (oldRole.hexColor !== newRole.hexColor) { + client.emit( + 'roleColorUpdate', + newRole, + oldRole.hexColor, + newRole.hexColor + ); + } + + if (oldRole.editable !== newRole.editable) { + client.emit( + 'roleEditUpdate', + newRole, + oldRole.editable, + newRole.editable + ); + } + + if (oldRole.hoist !== newRole.hoist) { + client.emit( + 'roleHoistUpdate', + newRole, + oldRole.hoist, + newRole.hoist + ); + } + + if (oldRole.icon !== newRole.icon) { + client.emit( + 'roleIconUpdate', + newRole, + oldRole.icon, + newRole.icon + ); + } + + if (oldRole.managed !== newRole.managed) { + client.emit( + 'roleManageUpdate', + newRole, + oldRole.managed, + newRole.managed + ); + } + + if (oldRole.mentionable !== newRole.mentionable) { + client.emit( + 'roleMentionUpdate', + newRole, + oldRole.mentionable, + newRole.mentionable + ); + } + + if (oldRole.name !== newRole.name) { + client.emit( + 'roleNameUpdate', + newRole, + oldRole.name, + newRole.name + ); + } + } }); diff --git a/packages/plugin-moreevents/src/listeners/thread_update.ts b/packages/plugin-moreevents/src/listeners/thread_update.ts index aff2109..25428ba 100644 --- a/packages/plugin-moreevents/src/listeners/thread_update.ts +++ b/packages/plugin-moreevents/src/listeners/thread_update.ts @@ -14,7 +14,7 @@ new Listener({ 'threadNameUpdate', newThread, oldThread.name, - newThread.name, + newThread.name ); if (oldThread.locked !== newThread.locked) @@ -25,7 +25,7 @@ new Listener({ 'threadRateLimitPerUserUpdate', newThread, oldThread.rateLimitPerUser, - newThread.rateLimitPerUser, + newThread.rateLimitPerUser ); if (oldThread.autoArchiveDuration !== newThread.autoArchiveDuration) @@ -33,7 +33,7 @@ new Listener({ 'threadAutoArchiveDurationUpdate', newThread, oldThread.autoArchiveDuration, - newThread.autoArchiveDuration, + newThread.autoArchiveDuration ); - }, + } }); diff --git a/packages/plugin-moreevents/src/listeners/user_update.ts b/packages/plugin-moreevents/src/listeners/user_update.ts index a270d4c..922d8f7 100644 --- a/packages/plugin-moreevents/src/listeners/user_update.ts +++ b/packages/plugin-moreevents/src/listeners/user_update.ts @@ -6,12 +6,12 @@ new Listener({ run: (oldUser, newUser) => { const client = oldUser.client; - if (oldUser.displayAvatarURL() !== newUser.displayAvatarURL()) { + if (oldUser.avatar !== newUser.avatar) { client.emit( 'userAvatarUpdate', newUser, - oldUser.displayAvatarURL(), - newUser.displayAvatarURL(), + oldUser.avatarURL(), + newUser.avatarURL() ); } @@ -20,7 +20,7 @@ new Listener({ 'userUsernameUpdate', newUser, oldUser.username, - newUser.username, + newUser.username ); } @@ -29,7 +29,7 @@ new Listener({ 'userDiscriminatorUpdate', newUser, oldUser.discriminator, - newUser.discriminator, + newUser.discriminator ); } @@ -40,5 +40,5 @@ new Listener({ if (oldUser.banner !== newUser.banner) { client.emit('userBannerUpdate', newUser, oldUser.banner, newUser.banner); } - }, + } }); diff --git a/packages/plugin-moreevents/src/listeners/voice_state_update.ts b/packages/plugin-moreevents/src/listeners/voice_state_update.ts index f1a822c..8d833a7 100644 --- a/packages/plugin-moreevents/src/listeners/voice_state_update.ts +++ b/packages/plugin-moreevents/src/listeners/voice_state_update.ts @@ -15,11 +15,7 @@ new Listener({ client.emit('voiceChannelLeave', member, oldState.channel); } - if ( - oldState.channel && - newState.channel && - oldState.channel.id !== newState.channel.id - ) { + if (oldState.channel && newState.channel && oldState.channel.id !== newState.channel.id) { client.emit( 'voiceChannelSwitch', member, @@ -40,12 +36,12 @@ new Listener({ if (!oldState.deaf && newState.deaf) { const deafType = newState.selfDeaf ? 'self-deafened' : 'server-deafened'; - client.emit('voiceChannelDeafen', member, deafType); + client.emit('voiceChannelDeaf', member, deafType); } if (oldState.deaf && !newState.deaf) { const deafType = oldState.selfDeaf ? 'self-deafened' : 'server-deafened'; - client.emit('voiceChannelUndeafen', member, deafType); + client.emit('voiceChannelUndeaf', member, deafType); } if (!oldState.streaming && newState.streaming) { @@ -55,5 +51,13 @@ new Listener({ if (oldState.streaming && !newState.streaming) { client.emit('voiceStreamingStop', member, newState.channel); } + + if (oldState.selfVideo && !newState.selfVideo) { + client.emit('voiceCameraDisabled', member, newState.channel); + } + + if (!oldState.selfVideo && newState.selfVideo) { + client.emit('voiceCameraEnabled', member, newState.channel); + } }, });