Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added more events #73

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
51 changes: 48 additions & 3 deletions packages/plugin-moreevents/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,49 @@ 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
- guildOwnerUpdate
- 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
Expand All @@ -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
Expand All @@ -83,3 +121,10 @@ List of events:

- rolePositionUpdate
- rolePermissionsUpdate
- roleColorUpdate
- roleEditUpdate
- roleHoistUpdate
- roleIconUpdate
- roleManageUpdate
- roleMentionUpdate
- roleNameUpdate
56 changes: 49 additions & 7 deletions packages/plugin-moreevents/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,50 @@ 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<SystemChannelFlagsBitField>, Readonly<SystemChannelFlagsBitField>];
guildVanityURLUpdate: [Guild, string, string];
guildFeaturesUpdate: [Guild, object, object];
guildAcronymUpdate: [Guild, string, string];
guildOwnerUpdate: [Guild, string, string];
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];
Expand All @@ -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<GuildMemberFlagsBitField>, Readonly<GuildMemberFlagsBitField>];

userAvatarUpdate: [User, string, string];
userUsernameUpdate: [User, string, string];
Expand All @@ -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];
}
}

Expand Down
90 changes: 59 additions & 31 deletions packages/plugin-moreevents/src/listeners/channel_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
}

Expand All @@ -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
);
}
},
}
});
Loading