@ovencord/discord.js 14.16.3
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/LICENSE +191 -0
- package/README.md +148 -0
- package/package.json +73 -0
- package/src/client/Client.ts +967 -0
- package/src/client/actions/Action.ts +141 -0
- package/src/client/actions/ActionsManager.ts +138 -0
- package/src/client/actions/ChannelCreate.ts +21 -0
- package/src/client/actions/ChannelDelete.ts +20 -0
- package/src/client/actions/ChannelUpdate.ts +38 -0
- package/src/client/actions/GuildChannelsPositionUpdate.ts +17 -0
- package/src/client/actions/GuildEmojiCreate.ts +17 -0
- package/src/client/actions/GuildEmojiDelete.ts +16 -0
- package/src/client/actions/GuildEmojiUpdate.ts +17 -0
- package/src/client/actions/GuildEmojisUpdate.ts +30 -0
- package/src/client/actions/GuildMemberRemove.ts +29 -0
- package/src/client/actions/GuildMemberUpdate.ts +41 -0
- package/src/client/actions/GuildRoleCreate.ts +23 -0
- package/src/client/actions/GuildRoleDelete.ts +26 -0
- package/src/client/actions/GuildRolesPositionUpdate.ts +17 -0
- package/src/client/actions/GuildScheduledEventDelete.ts +28 -0
- package/src/client/actions/GuildScheduledEventUserAdd.ts +29 -0
- package/src/client/actions/GuildScheduledEventUserRemove.ts +29 -0
- package/src/client/actions/GuildSoundboardSoundDelete.ts +26 -0
- package/src/client/actions/GuildStickerCreate.ts +17 -0
- package/src/client/actions/GuildStickerDelete.ts +16 -0
- package/src/client/actions/GuildStickerUpdate.ts +17 -0
- package/src/client/actions/GuildStickersUpdate.ts +30 -0
- package/src/client/actions/GuildUpdate.ts +30 -0
- package/src/client/actions/InteractionCreate.ts +104 -0
- package/src/client/actions/MessageCreate.ts +38 -0
- package/src/client/actions/MessageDelete.ts +29 -0
- package/src/client/actions/MessageDeleteBulk.ts +45 -0
- package/src/client/actions/MessagePollVoteAdd.ts +37 -0
- package/src/client/actions/MessagePollVoteRemove.ts +35 -0
- package/src/client/actions/MessageReactionAdd.ts +68 -0
- package/src/client/actions/MessageReactionRemove.ts +47 -0
- package/src/client/actions/MessageReactionRemoveAll.ts +30 -0
- package/src/client/actions/MessageReactionRemoveEmoji.ts +25 -0
- package/src/client/actions/MessageUpdate.ts +22 -0
- package/src/client/actions/StageInstanceCreate.ts +25 -0
- package/src/client/actions/StageInstanceDelete.ts +28 -0
- package/src/client/actions/StageInstanceUpdate.ts +27 -0
- package/src/client/actions/ThreadCreate.ts +22 -0
- package/src/client/actions/ThreadMembersUpdate.ts +45 -0
- package/src/client/actions/TypingStart.ts +26 -0
- package/src/client/actions/UserUpdate.ts +33 -0
- package/src/client/voice/ClientVoiceManager.ts +46 -0
- package/src/client/websocket/handlers/APPLICATION_COMMAND_PERMISSIONS_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_ACTION_EXECUTION.ts +17 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_CREATE.ts +18 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_DELETE.ts +21 -0
- package/src/client/websocket/handlers/AUTO_MODERATION_RULE_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/CHANNEL_CREATE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_DELETE.ts +4 -0
- package/src/client/websocket/handlers/CHANNEL_PINS_UPDATE.ts +22 -0
- package/src/client/websocket/handlers/CHANNEL_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/ENTITLEMENT_CREATE.ts +14 -0
- package/src/client/websocket/handlers/ENTITLEMENT_DELETE.ts +18 -0
- package/src/client/websocket/handlers/ENTITLEMENT_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/GUILD_AUDIT_LOG_ENTRY_CREATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_BAN_ADD.ts +15 -0
- package/src/client/websocket/handlers/GUILD_BAN_REMOVE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_CREATE.ts +34 -0
- package/src/client/websocket/handlers/GUILD_DELETE.ts +36 -0
- package/src/client/websocket/handlers/GUILD_EMOJIS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_INTEGRATIONS_UPDATE.ts +15 -0
- package/src/client/websocket/handlers/GUILD_MEMBERS_CHUNK.ts +40 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_ADD.ts +17 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_MEMBER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_ROLE_UPDATE.ts +21 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_CREATE.ts +17 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_UPDATE.ts +19 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_ADD.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUNDS_UPDATE.ts +24 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_CREATE.ts +18 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_DELETE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_SOUNDBOARD_SOUND_UPDATE.ts +20 -0
- package/src/client/websocket/handlers/GUILD_STICKERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/GUILD_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/INTERACTION_CREATE.ts +4 -0
- package/src/client/websocket/handlers/INVITE_CREATE.ts +20 -0
- package/src/client/websocket/handlers/INVITE_DELETE.ts +23 -0
- package/src/client/websocket/handlers/MESSAGE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_DELETE_BULK.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_POLL_VOTE_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_ADD.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_ALL.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_REACTION_REMOVE_EMOJI.ts +4 -0
- package/src/client/websocket/handlers/MESSAGE_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/PRESENCE_UPDATE.ts +42 -0
- package/src/client/websocket/handlers/RATE_LIMITED.ts +23 -0
- package/src/client/websocket/handlers/READY.ts +29 -0
- package/src/client/websocket/handlers/SOUNDBOARD_SOUNDS.ts +24 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_CREATE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_DELETE.ts +4 -0
- package/src/client/websocket/handlers/STAGE_INSTANCE_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_CREATE.ts +14 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_DELETE.ts +16 -0
- package/src/client/websocket/handlers/SUBSCRIPTION_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/THREAD_CREATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_DELETE.ts +17 -0
- package/src/client/websocket/handlers/THREAD_LIST_SYNC.ts +50 -0
- package/src/client/websocket/handlers/THREAD_MEMBERS_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/THREAD_MEMBER_UPDATE.ts +25 -0
- package/src/client/websocket/handlers/THREAD_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/TYPING_START.ts +4 -0
- package/src/client/websocket/handlers/USER_UPDATE.ts +4 -0
- package/src/client/websocket/handlers/VOICE_CHANNEL_EFFECT_SEND.ts +16 -0
- package/src/client/websocket/handlers/VOICE_SERVER_UPDATE.ts +5 -0
- package/src/client/websocket/handlers/VOICE_STATE_UPDATE.ts +37 -0
- package/src/client/websocket/handlers/WEBHOOKS_UPDATE.ts +16 -0
- package/src/client/websocket/handlers/index.ts +74 -0
- package/src/errors/DJSError.ts +50 -0
- package/src/errors/ErrorCodes.ts +277 -0
- package/src/errors/Messages.ts +155 -0
- package/src/errors/index.ts +6 -0
- package/src/index.ts +241 -0
- package/src/managers/ApplicationCommandManager.ts +303 -0
- package/src/managers/ApplicationCommandPermissionsManager.ts +453 -0
- package/src/managers/ApplicationEmojiManager.ts +149 -0
- package/src/managers/AutoModerationRuleManager.ts +307 -0
- package/src/managers/BaseManager.ts +13 -0
- package/src/managers/CachedManager.ts +56 -0
- package/src/managers/CategoryChannelChildManager.ts +81 -0
- package/src/managers/ChannelManager.ts +194 -0
- package/src/managers/DMMessageManager.ts +15 -0
- package/src/managers/DataManager.ts +38 -0
- package/src/managers/EntitlementManager.ts +182 -0
- package/src/managers/GuildApplicationCommandManager.ts +29 -0
- package/src/managers/GuildBanManager.ts +221 -0
- package/src/managers/GuildChannelManager.ts +552 -0
- package/src/managers/GuildEmojiManager.ts +262 -0
- package/src/managers/GuildEmojiRoleManager.ts +134 -0
- package/src/managers/GuildForumThreadManager.ts +84 -0
- package/src/managers/GuildInviteManager.ts +236 -0
- package/src/managers/GuildManager.ts +265 -0
- package/src/managers/GuildMemberManager.ts +619 -0
- package/src/managers/GuildMemberRoleManager.ts +230 -0
- package/src/managers/GuildMessageManager.ts +31 -0
- package/src/managers/GuildScheduledEventManager.ts +330 -0
- package/src/managers/GuildSoundboardSoundManager.ts +157 -0
- package/src/managers/GuildStickerManager.ts +192 -0
- package/src/managers/GuildTextThreadManager.ts +91 -0
- package/src/managers/MessageManager.ts +352 -0
- package/src/managers/PartialGroupDMMessageManager.ts +15 -0
- package/src/managers/PermissionOverwriteManager.ts +174 -0
- package/src/managers/PollAnswerVoterManager.ts +59 -0
- package/src/managers/PresenceManager.ts +60 -0
- package/src/managers/ReactionManager.ts +72 -0
- package/src/managers/ReactionUserManager.ts +82 -0
- package/src/managers/RoleManager.ts +432 -0
- package/src/managers/StageInstanceManager.ts +166 -0
- package/src/managers/SubscriptionManager.ts +83 -0
- package/src/managers/ThreadManager.ts +210 -0
- package/src/managers/ThreadMemberManager.ts +194 -0
- package/src/managers/UserManager.ts +139 -0
- package/src/managers/VoiceStateManager.ts +61 -0
- package/src/sharding/Shard.ts +513 -0
- package/src/sharding/ShardClientUtil.ts +293 -0
- package/src/sharding/ShardingManager.ts +374 -0
- package/src/structures/ActionRow.ts +31 -0
- package/src/structures/AnnouncementChannel.ts +25 -0
- package/src/structures/AnonymousGuild.ts +110 -0
- package/src/structures/ApplicationCommand.ts +675 -0
- package/src/structures/ApplicationEmoji.ts +189 -0
- package/src/structures/ApplicationRoleConnectionMetadata.ts +54 -0
- package/src/structures/Attachment.ts +189 -0
- package/src/structures/AuthorizingIntegrationOwners.ts +63 -0
- package/src/structures/AutoModerationActionExecution.ts +138 -0
- package/src/structures/AutoModerationRule.ts +325 -0
- package/src/structures/AutocompleteInteraction.ts +115 -0
- package/src/structures/Base.ts +37 -0
- package/src/structures/BaseChannel.ts +188 -0
- package/src/structures/BaseGuild.ts +134 -0
- package/src/structures/BaseGuildEmoji.ts +113 -0
- package/src/structures/BaseGuildTextChannel.ts +230 -0
- package/src/structures/BaseGuildVoiceChannel.ts +270 -0
- package/src/structures/BaseInteraction.ts +393 -0
- package/src/structures/BaseInvite.ts +192 -0
- package/src/structures/BaseSelectMenuComponent.ts +58 -0
- package/src/structures/ButtonComponent.ts +68 -0
- package/src/structures/ButtonInteraction.ts +8 -0
- package/src/structures/CategoryChannel.ts +46 -0
- package/src/structures/ChannelSelectMenuComponent.ts +18 -0
- package/src/structures/ChannelSelectMenuInteraction.ts +34 -0
- package/src/structures/ChatInputCommandInteraction.ts +43 -0
- package/src/structures/ClientApplication.ts +470 -0
- package/src/structures/ClientPresence.ts +87 -0
- package/src/structures/ClientUser.ts +219 -0
- package/src/structures/CommandInteraction.ts +193 -0
- package/src/structures/CommandInteractionOptionResolver.ts +336 -0
- package/src/structures/Component.ts +59 -0
- package/src/structures/ContainerComponent.ts +63 -0
- package/src/structures/ContextMenuCommandInteraction.ts +68 -0
- package/src/structures/DMChannel.ts +148 -0
- package/src/structures/DirectoryChannel.ts +40 -0
- package/src/structures/Embed.ts +251 -0
- package/src/structures/Emoji.ts +61 -0
- package/src/structures/Entitlement.ts +206 -0
- package/src/structures/FileComponent.ts +41 -0
- package/src/structures/ForumChannel.ts +31 -0
- package/src/structures/GroupDMInvite.ts +34 -0
- package/src/structures/Guild.ts +1605 -0
- package/src/structures/GuildAuditLogs.ts +99 -0
- package/src/structures/GuildAuditLogsEntry.ts +557 -0
- package/src/structures/GuildBan.ts +65 -0
- package/src/structures/GuildChannel.ts +515 -0
- package/src/structures/GuildEmoji.ts +159 -0
- package/src/structures/GuildInvite.ts +233 -0
- package/src/structures/GuildMember.ts +643 -0
- package/src/structures/GuildOnboarding.ts +73 -0
- package/src/structures/GuildOnboardingPrompt.ts +93 -0
- package/src/structures/GuildOnboardingPromptOption.ts +100 -0
- package/src/structures/GuildPreview.ts +218 -0
- package/src/structures/GuildPreviewEmoji.ts +28 -0
- package/src/structures/GuildScheduledEvent.ts +593 -0
- package/src/structures/GuildTemplate.ts +229 -0
- package/src/structures/Integration.ts +257 -0
- package/src/structures/IntegrationApplication.ts +84 -0
- package/src/structures/InteractionCallback.ts +86 -0
- package/src/structures/InteractionCallbackResource.ts +57 -0
- package/src/structures/InteractionCallbackResponse.ts +35 -0
- package/src/structures/InteractionCollector.ts +260 -0
- package/src/structures/InteractionWebhook.ts +65 -0
- package/src/structures/InviteGuild.ts +22 -0
- package/src/structures/LabelComponent.ts +51 -0
- package/src/structures/MediaChannel.ts +8 -0
- package/src/structures/MediaGalleryComponent.ts +31 -0
- package/src/structures/MediaGalleryItem.ts +54 -0
- package/src/structures/MentionableSelectMenuComponent.ts +8 -0
- package/src/structures/MentionableSelectMenuInteraction.ts +76 -0
- package/src/structures/Message.ts +1202 -0
- package/src/structures/MessageCollector.ts +155 -0
- package/src/structures/MessageComponentInteraction.ts +132 -0
- package/src/structures/MessageContextMenuCommandInteraction.ts +18 -0
- package/src/structures/MessageMentions.ts +327 -0
- package/src/structures/MessagePayload.ts +325 -0
- package/src/structures/MessageReaction.ts +219 -0
- package/src/structures/ModalComponentResolver.ts +237 -0
- package/src/structures/ModalSubmitInteraction.ts +260 -0
- package/src/structures/OAuth2Guild.ts +30 -0
- package/src/structures/PartialGroupDMChannel.ts +151 -0
- package/src/structures/PermissionOverwrites.ts +222 -0
- package/src/structures/Poll.ts +195 -0
- package/src/structures/PollAnswer.ts +100 -0
- package/src/structures/Presence.ts +448 -0
- package/src/structures/PrimaryEntryPointCommandInteraction.ts +8 -0
- package/src/structures/ReactionCollector.ts +245 -0
- package/src/structures/ReactionEmoji.ts +30 -0
- package/src/structures/Role.ts +543 -0
- package/src/structures/RoleSelectMenuComponent.ts +8 -0
- package/src/structures/RoleSelectMenuInteraction.ts +34 -0
- package/src/structures/SKU.ts +62 -0
- package/src/structures/SectionComponent.ts +44 -0
- package/src/structures/SeparatorComponent.ts +29 -0
- package/src/structures/SoundboardSound.ts +176 -0
- package/src/structures/StageChannel.ts +118 -0
- package/src/structures/StageInstance.ts +173 -0
- package/src/structures/Sticker.ts +300 -0
- package/src/structures/StickerPack.ts +111 -0
- package/src/structures/StringSelectMenuComponent.ts +18 -0
- package/src/structures/StringSelectMenuInteraction.ts +21 -0
- package/src/structures/Subscription.ts +138 -0
- package/src/structures/Team.ts +131 -0
- package/src/structures/TeamMember.ts +77 -0
- package/src/structures/TextChannel.ts +33 -0
- package/src/structures/TextDisplayComponent.ts +18 -0
- package/src/structures/TextInputComponent.ts +28 -0
- package/src/structures/ThreadChannel.ts +680 -0
- package/src/structures/ThreadMember.ts +125 -0
- package/src/structures/ThreadOnlyChannel.ts +276 -0
- package/src/structures/ThumbnailComponent.ts +51 -0
- package/src/structures/Typing.ts +81 -0
- package/src/structures/UnfurledMediaItem.ts +33 -0
- package/src/structures/User.ts +511 -0
- package/src/structures/UserContextMenuCommandInteraction.ts +28 -0
- package/src/structures/UserSelectMenuComponent.ts +8 -0
- package/src/structures/UserSelectMenuInteraction.ts +54 -0
- package/src/structures/VoiceChannel.ts +119 -0
- package/src/structures/VoiceChannelEffect.ts +92 -0
- package/src/structures/VoiceRegion.ts +52 -0
- package/src/structures/VoiceState.ts +346 -0
- package/src/structures/Webhook.ts +526 -0
- package/src/structures/WelcomeChannel.ts +67 -0
- package/src/structures/WelcomeScreen.ts +53 -0
- package/src/structures/Widget.ts +110 -0
- package/src/structures/WidgetMember.ts +124 -0
- package/src/structures/interfaces/Application.ts +179 -0
- package/src/structures/interfaces/Collector.ts +372 -0
- package/src/structures/interfaces/InteractionResponses.ts +384 -0
- package/src/structures/interfaces/TextBasedChannel.ts +430 -0
- package/src/util/APITypes.ts +690 -0
- package/src/util/ActivityFlagsBitField.ts +26 -0
- package/src/util/ApplicationFlagsBitField.ts +43 -0
- package/src/util/AttachmentFlagsBitField.ts +26 -0
- package/src/util/BitField.ts +178 -0
- package/src/util/ChannelFlagsBitField.ts +43 -0
- package/src/util/Channels.ts +165 -0
- package/src/util/Colors.ts +72 -0
- package/src/util/Components.ts +285 -0
- package/src/util/Constants.ts +251 -0
- package/src/util/DataResolver.ts +146 -0
- package/src/util/Enums.ts +10 -0
- package/src/util/Events.ts +178 -0
- package/src/util/GuildMemberFlagsBitField.ts +43 -0
- package/src/util/IntentsBitField.ts +35 -0
- package/src/util/InviteFlagsBitField.ts +26 -0
- package/src/util/Invites.ts +27 -0
- package/src/util/LimitedCollection.ts +73 -0
- package/src/util/MessageFlagsBitField.ts +43 -0
- package/src/util/Options.ts +215 -0
- package/src/util/Partials.ts +50 -0
- package/src/util/PermissionsBitField.ts +113 -0
- package/src/util/RoleFlagsBitField.ts +26 -0
- package/src/util/SKUFlagsBitField.ts +26 -0
- package/src/util/ShardEvents.ts +26 -0
- package/src/util/Status.ts +16 -0
- package/src/util/Sweepers.ts +532 -0
- package/src/util/Symbols.ts +1 -0
- package/src/util/SystemChannelFlagsBitField.ts +45 -0
- package/src/util/ThreadMemberFlagsBitField.ts +33 -0
- package/src/util/Transformers.ts +123 -0
- package/src/util/UserFlagsBitField.ts +33 -0
- package/src/util/Util.ts +519 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Events } from '../../util/Events.js';
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
|
|
4
|
+
export class StageInstanceCreateAction extends Action {
|
|
5
|
+
handle(data) {
|
|
6
|
+
const client = this.client;
|
|
7
|
+
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
|
8
|
+
|
|
9
|
+
if (channel) {
|
|
10
|
+
const stageInstance = channel.guild.stageInstances._add(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a stage instance is created.
|
|
14
|
+
*
|
|
15
|
+
* @event Client#stageInstanceCreate
|
|
16
|
+
* @param {StageInstance} stageInstance The created stage instance
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.StageInstanceCreate, stageInstance);
|
|
19
|
+
|
|
20
|
+
return { stageInstance };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Events } from '../../util/Events.js';
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
|
|
4
|
+
export class StageInstanceDeleteAction extends Action {
|
|
5
|
+
handle(data) {
|
|
6
|
+
const client = this.client;
|
|
7
|
+
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
|
8
|
+
|
|
9
|
+
if (channel) {
|
|
10
|
+
const stageInstance = channel.guild.stageInstances._add(data);
|
|
11
|
+
if (stageInstance) {
|
|
12
|
+
channel.guild.stageInstances.cache.delete(stageInstance.id);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Emitted whenever a stage instance is deleted.
|
|
16
|
+
*
|
|
17
|
+
* @event Client#stageInstanceDelete
|
|
18
|
+
* @param {StageInstance} stageInstance The deleted stage instance
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.StageInstanceDelete, stageInstance);
|
|
21
|
+
|
|
22
|
+
return { stageInstance };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Events } from '../../util/Events.js';
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
|
|
4
|
+
export class StageInstanceUpdateAction extends Action {
|
|
5
|
+
handle(data) {
|
|
6
|
+
const client = this.client;
|
|
7
|
+
const channel = this.getChannel({ id: data.channel_id, guild_id: data.guild_id });
|
|
8
|
+
|
|
9
|
+
if (channel) {
|
|
10
|
+
const oldStageInstance = channel.guild.stageInstances.cache.get(data.id)?._clone() ?? null;
|
|
11
|
+
const newStageInstance = channel.guild.stageInstances._add(data);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever a stage instance gets updated - e.g. change in topic or privacy level
|
|
15
|
+
*
|
|
16
|
+
* @event Client#stageInstanceUpdate
|
|
17
|
+
* @param {?StageInstance} oldStageInstance The stage instance before the update
|
|
18
|
+
* @param {StageInstance} newStageInstance The stage instance after the update
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.StageInstanceUpdate, oldStageInstance, newStageInstance);
|
|
21
|
+
|
|
22
|
+
return { oldStageInstance, newStageInstance };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Events } from '../../util/Events.js';
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
|
|
4
|
+
export class ThreadCreateAction extends Action {
|
|
5
|
+
handle(data) {
|
|
6
|
+
const client = this.client;
|
|
7
|
+
const existing = client.channels.cache.has(data.id);
|
|
8
|
+
const thread = client.channels._add(data);
|
|
9
|
+
if (!existing && thread) {
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever a thread is created or when the client user is added to a thread.
|
|
12
|
+
*
|
|
13
|
+
* @event Client#threadCreate
|
|
14
|
+
* @param {ThreadChannel} thread The thread that was created
|
|
15
|
+
* @param {boolean} newlyCreated Whether the thread was newly created
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.ThreadCreate, thread, data.newly_created ?? false);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { thread };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Collection } from '@ovencord/collection';
|
|
2
|
+
import { Events } from '../../util/Events.js';
|
|
3
|
+
import { Action } from './Action.js';
|
|
4
|
+
|
|
5
|
+
export class ThreadMembersUpdateAction extends Action {
|
|
6
|
+
handle(data) {
|
|
7
|
+
const client = this.client;
|
|
8
|
+
const thread = client.channels.cache.get(data.id);
|
|
9
|
+
if (thread) {
|
|
10
|
+
thread.memberCount = data.member_count;
|
|
11
|
+
const addedMembers = new Collection();
|
|
12
|
+
const removedMembers = new Collection();
|
|
13
|
+
|
|
14
|
+
data.added_members?.reduce(
|
|
15
|
+
(_addedMembers, addedMember) => _addedMembers.set(addedMember.user_id, thread.members._add(addedMember)),
|
|
16
|
+
addedMembers,
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
data.removed_member_ids?.reduce((removedMembersIds, removedMembersId) => {
|
|
20
|
+
const threadMember = this.getThreadMember(removedMembersId, thread.members);
|
|
21
|
+
if (threadMember) removedMembersIds.set(threadMember.id, threadMember);
|
|
22
|
+
thread.members.cache.delete(removedMembersId);
|
|
23
|
+
return removedMembersIds;
|
|
24
|
+
}, removedMembers);
|
|
25
|
+
|
|
26
|
+
if (addedMembers.size === 0 && removedMembers.size === 0) {
|
|
27
|
+
// Uncached thread member(s) left.
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Emitted whenever members are added or removed from a thread.
|
|
33
|
+
* <info>This event requires the {@link GatewayIntentBits.GuildMembers} privileged gateway intent.</info>
|
|
34
|
+
*
|
|
35
|
+
* @event Client#threadMembersUpdate
|
|
36
|
+
* @param {Collection<Snowflake, ThreadMember>} addedMembers The members that were added
|
|
37
|
+
* @param {Collection<Snowflake, ThreadMember>} removedMembers The members that were removed
|
|
38
|
+
* @param {ThreadChannel} thread The thread where members got updated
|
|
39
|
+
*/
|
|
40
|
+
client.emit(Events.ThreadMembersUpdate, addedMembers, removedMembers, thread);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Typing } from '../../structures/Typing.js';
|
|
2
|
+
import { Events } from '../../util/Events.js';
|
|
3
|
+
import { Action } from './Action.js';
|
|
4
|
+
|
|
5
|
+
export class TypingStartAction extends Action {
|
|
6
|
+
handle(data) {
|
|
7
|
+
const channel = this.getChannel({ id: data.channel_id, ...('guild_id' in data && { guild_id: data.guild_id }) });
|
|
8
|
+
if (!channel) return;
|
|
9
|
+
|
|
10
|
+
if (!channel.isTextBased()) {
|
|
11
|
+
this.client.emit(Events.Warn, `Discord sent a typing packet to a ${channel.type} channel ${channel.id}`);
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const user = this.getUserFromMember(data);
|
|
16
|
+
if (user) {
|
|
17
|
+
/**
|
|
18
|
+
* Emitted whenever a user starts typing in a channel.
|
|
19
|
+
*
|
|
20
|
+
* @event Client#typingStart
|
|
21
|
+
* @param {Typing} typing The typing state
|
|
22
|
+
*/
|
|
23
|
+
this.client.emit(Events.TypingStart, new Typing(channel, user, data));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Events } from '../../util/Events.js';
|
|
2
|
+
import { Action } from './Action.js';
|
|
3
|
+
|
|
4
|
+
export class UserUpdateAction extends Action {
|
|
5
|
+
handle(data) {
|
|
6
|
+
const client = this.client;
|
|
7
|
+
|
|
8
|
+
const newUser = data.id === client.user.id ? client.user : client.users.cache.get(data.id);
|
|
9
|
+
const oldUser = newUser._update(data);
|
|
10
|
+
|
|
11
|
+
if (!oldUser.equals(newUser)) {
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a user's details (e.g. username) are changed.
|
|
14
|
+
* Triggered by the Discord gateway events {@link Events.UserUpdate},
|
|
15
|
+
* {@link Events.GuildMemberUpdate}, and {@link Events.PresenceUpdate}.
|
|
16
|
+
*
|
|
17
|
+
* @event Client#userUpdate
|
|
18
|
+
* @param {User} oldUser The user before the update
|
|
19
|
+
* @param {User} newUser The user after the update
|
|
20
|
+
*/
|
|
21
|
+
client.emit(Events.UserUpdate, oldUser, newUser);
|
|
22
|
+
return {
|
|
23
|
+
old: oldUser,
|
|
24
|
+
updated: newUser,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
old: null,
|
|
30
|
+
updated: null,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { WebSocketShardEvents, CloseCodes } from '@ovencord/ws';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Manages voice connections for the client
|
|
5
|
+
*/
|
|
6
|
+
export class ClientVoiceManager {
|
|
7
|
+
public client: any;
|
|
8
|
+
public adapters: any;
|
|
9
|
+
constructor(client) {
|
|
10
|
+
/**
|
|
11
|
+
* The client that instantiated this voice manager
|
|
12
|
+
*
|
|
13
|
+
* @type {Client}
|
|
14
|
+
* @readonly
|
|
15
|
+
* @name ClientVoiceManager#client
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(this, 'client', { value: client });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Maps guild ids to voice adapters created for use with `@ovencord/voice`.
|
|
21
|
+
*
|
|
22
|
+
* @type {Map<Snowflake, Object>}
|
|
23
|
+
*/
|
|
24
|
+
this.adapters = new Map();
|
|
25
|
+
|
|
26
|
+
client.ws.on(WebSocketShardEvents.Closed, (code, shardId) => {
|
|
27
|
+
if (code === CloseCodes.Normal) {
|
|
28
|
+
for (const [guildId, adapter] of this.adapters.entries()) {
|
|
29
|
+
if (client.guilds.cache.get(guildId)?.shardId === shardId) {
|
|
30
|
+
adapter.destroy();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
onVoiceServer(payload) {
|
|
38
|
+
this.adapters.get(payload.guild_id)?.onVoiceServerUpdate(payload);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
onVoiceStateUpdate(payload) {
|
|
42
|
+
if (payload.guild_id && payload.session_id && payload.user_id === this.client.user?.id) {
|
|
43
|
+
this.adapters.get(payload.guild_id)?.onVoiceStateUpdate(payload);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
/**
|
|
6
|
+
* Emitted whenever permissions for an application command in a guild were updated.
|
|
7
|
+
* <warn>This includes permission updates for other applications in addition to the logged in client,
|
|
8
|
+
* check `data.applicationId` to verify which application the update is for</warn>
|
|
9
|
+
*
|
|
10
|
+
* @event Client#applicationCommandPermissionsUpdate
|
|
11
|
+
* @param {ApplicationCommandPermissionsUpdateData} data The updated permissions
|
|
12
|
+
*/
|
|
13
|
+
client.emit(Events.ApplicationCommandPermissionsUpdate, {
|
|
14
|
+
permissions: data.permissions,
|
|
15
|
+
id: data.id,
|
|
16
|
+
guildId: data.guild_id,
|
|
17
|
+
applicationId: data.application_id,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { AutoModerationActionExecution } from '../../../structures/AutoModerationActionExecution.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever an auto moderation rule is triggered.
|
|
11
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
12
|
+
*
|
|
13
|
+
* @event Client#autoModerationActionExecution
|
|
14
|
+
* @param {AutoModerationActionExecution} autoModerationActionExecution The data of the execution
|
|
15
|
+
*/
|
|
16
|
+
client.emit(Events.AutoModerationActionExecution, new AutoModerationActionExecution(data, guild));
|
|
17
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const autoModerationRule = guild.autoModerationRules._add(data);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Emitted whenever an auto moderation rule is created.
|
|
12
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
13
|
+
*
|
|
14
|
+
* @event Client#autoModerationRuleCreate
|
|
15
|
+
* @param {AutoModerationRule} autoModerationRule The created auto moderation rule
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.AutoModerationRuleCreate, autoModerationRule);
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const autoModerationRule = guild.autoModerationRules.cache.get(data.id);
|
|
9
|
+
if (!autoModerationRule) return;
|
|
10
|
+
|
|
11
|
+
guild.autoModerationRules.cache.delete(autoModerationRule.id);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever an auto moderation rule is deleted.
|
|
15
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
16
|
+
*
|
|
17
|
+
* @event Client#autoModerationRuleDelete
|
|
18
|
+
* @param {AutoModerationRule} autoModerationRule The deleted auto moderation rule
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.AutoModerationRuleDelete, autoModerationRule);
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
const oldAutoModerationRule = guild.autoModerationRules.cache.get(data.id)?._clone() ?? null;
|
|
9
|
+
const newAutoModerationRule = guild.autoModerationRules._add(data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever an auto moderation rule gets updated.
|
|
13
|
+
* <info>This event requires the {@link PermissionFlagsBits.ManageGuild} permission.</info>
|
|
14
|
+
*
|
|
15
|
+
* @event Client#autoModerationRuleUpdate
|
|
16
|
+
* @param {?AutoModerationRule} oldAutoModerationRule The auto moderation rule before the update
|
|
17
|
+
* @param {AutoModerationRule} newAutoModerationRule The auto moderation rule after the update
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.AutoModerationRuleUpdate, oldAutoModerationRule, newAutoModerationRule);
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const channel = client.channels.cache.get(data.channel_id);
|
|
6
|
+
const time = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null;
|
|
7
|
+
|
|
8
|
+
if (channel) {
|
|
9
|
+
// Discord sends null for last_pin_timestamp if the last pinned message was removed
|
|
10
|
+
channel.lastPinTimestamp = time;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event,
|
|
14
|
+
* not much information can be provided easily here - you need to manually check the pins yourself.
|
|
15
|
+
*
|
|
16
|
+
* @event Client#channelPinsUpdate
|
|
17
|
+
* @param {TextBasedChannels} channel The channel that the pins update occurred in
|
|
18
|
+
* @param {Date} time The time of the pins update
|
|
19
|
+
*/
|
|
20
|
+
client.emit(Events.ChannelPinsUpdate, channel, time);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, packet) => {
|
|
5
|
+
const { old, updated } = client.actions.ChannelUpdate.handle(packet.d);
|
|
6
|
+
if (old && updated) {
|
|
7
|
+
/**
|
|
8
|
+
* Emitted whenever a channel is updated - e.g. name change, topic change, channel type change.
|
|
9
|
+
*
|
|
10
|
+
* @event Client#channelUpdate
|
|
11
|
+
* @param {DMChannel|GuildChannel} oldChannel The channel before the update
|
|
12
|
+
* @param {DMChannel|GuildChannel} newChannel The channel after the update
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.ChannelUpdate, old, updated);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const entitlement = client.application.entitlements._add(data);
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Emitted whenever an entitlement is created.
|
|
9
|
+
*
|
|
10
|
+
* @event Client#entitlementCreate
|
|
11
|
+
* @param {Entitlement} entitlement The entitlement that was created
|
|
12
|
+
*/
|
|
13
|
+
client.emit(Events.EntitlementCreate, entitlement);
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const entitlement = client.application.entitlements._add(data, false);
|
|
6
|
+
|
|
7
|
+
client.application.entitlements.cache.delete(entitlement.id);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Emitted whenever an entitlement is deleted.
|
|
11
|
+
* <warn>Entitlements are not deleted when they expire.
|
|
12
|
+
* This is only triggered when Discord issues a refund or deletes the entitlement manually.</warn>
|
|
13
|
+
*
|
|
14
|
+
* @event Client#entitlementDelete
|
|
15
|
+
* @param {Entitlement} entitlement The entitlement that was deleted
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.EntitlementDelete, entitlement);
|
|
18
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const oldEntitlement = client.application.entitlements.cache.get(data.id)?._clone() ?? null;
|
|
6
|
+
const newEntitlement = client.application.entitlements._add(data);
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever an entitlement is updated - i.e. when a user's subscription renews.
|
|
10
|
+
*
|
|
11
|
+
* @event Client#entitlementUpdate
|
|
12
|
+
* @param {?Entitlement} oldEntitlement The entitlement before the update
|
|
13
|
+
* @param {Entitlement} newEntitlement The entitlement after the update
|
|
14
|
+
*/
|
|
15
|
+
client.emit(Events.EntitlementUpdate, oldEntitlement, newEntitlement);
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
import { GuildAuditLogsEntry } from '../../../structures/GuildAuditLogsEntry.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const auditLogEntry = new GuildAuditLogsEntry(guild, data);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild audit log entry is created.
|
|
13
|
+
*
|
|
14
|
+
* @event Client#guildAuditLogEntryCreate
|
|
15
|
+
* @param {GuildAuditLogsEntry} auditLogEntry The entry that was created
|
|
16
|
+
* @param {Guild} guild The guild where the entry was created
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.GuildAuditLogEntryCreate, auditLogEntry, guild);
|
|
19
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever a member is banned from a guild.
|
|
10
|
+
*
|
|
11
|
+
* @event Client#guildBanAdd
|
|
12
|
+
* @param {GuildBan} ban The ban that occurred
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildBanAdd, guild.bans._add(data));
|
|
15
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
import { GuildBan } from '../../../structures/GuildBan.js';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
|
|
9
|
+
const ban = guild.bans.cache.get(data.user.id) ?? new GuildBan(client, data, guild);
|
|
10
|
+
|
|
11
|
+
guild.bans.cache.delete(ban.user.id);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Emitted whenever a member is unbanned from a guild.
|
|
15
|
+
*
|
|
16
|
+
* @event Client#guildBanRemove
|
|
17
|
+
* @param {GuildBan} ban The ban that was removed
|
|
18
|
+
*/
|
|
19
|
+
client.emit(Events.GuildBanRemove, ban);
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
import { Status } from '../../../util/Status.js';
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }, shardId) => {
|
|
6
|
+
let guild = client.guilds.cache.get(data.id);
|
|
7
|
+
if (guild) {
|
|
8
|
+
if (!guild.available && !data.unavailable) {
|
|
9
|
+
// A newly available guild
|
|
10
|
+
guild._patch(data);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Emitted whenever a guild becomes available.
|
|
14
|
+
*
|
|
15
|
+
* @event Client#guildAvailable
|
|
16
|
+
* @param {Guild} guild The guild that became available
|
|
17
|
+
*/
|
|
18
|
+
client.emit(Events.GuildAvailable, guild);
|
|
19
|
+
}
|
|
20
|
+
} else {
|
|
21
|
+
// A new guild
|
|
22
|
+
data.shardId = shardId;
|
|
23
|
+
guild = client.guilds._add(data);
|
|
24
|
+
if (client.status === Status.Ready) {
|
|
25
|
+
/**
|
|
26
|
+
* Emitted whenever the client joins a guild.
|
|
27
|
+
*
|
|
28
|
+
* @event Client#guildCreate
|
|
29
|
+
* @param {Guild} guild The created guild
|
|
30
|
+
*/
|
|
31
|
+
client.emit(Events.GuildCreate, guild);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
if (data.unavailable) {
|
|
9
|
+
guild.available = false;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Emitted whenever a guild becomes unavailable, likely due to a server outage.
|
|
13
|
+
*
|
|
14
|
+
* @event Client#guildUnavailable
|
|
15
|
+
* @param {Guild} guild The guild that has become unavailable
|
|
16
|
+
*/
|
|
17
|
+
client.emit(Events.GuildUnavailable, guild);
|
|
18
|
+
|
|
19
|
+
// Stops the GuildDelete packet thinking a guild was actually deleted,
|
|
20
|
+
// handles emitting of event itself
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const channel of guild.channels.cache.values()) client.channels._remove(channel.id);
|
|
25
|
+
client.voice.adapters.get(data.id)?.destroy();
|
|
26
|
+
|
|
27
|
+
client.guilds.cache.delete(guild.id);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Emitted whenever a guild kicks the client or the guild is deleted/left.
|
|
31
|
+
*
|
|
32
|
+
* @event Client#guildDelete
|
|
33
|
+
* @param {Guild} guild The guild that was deleted
|
|
34
|
+
*/
|
|
35
|
+
client.emit(Events.GuildDelete, guild);
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Events } from '../../../util/Events.js';
|
|
3
|
+
|
|
4
|
+
module.exports = (client, { d: data }) => {
|
|
5
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
6
|
+
if (!guild) return;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Emitted whenever a guild integration is updated
|
|
10
|
+
*
|
|
11
|
+
* @event Client#guildIntegrationsUpdate
|
|
12
|
+
* @param {Guild} guild The guild whose integrations were updated
|
|
13
|
+
*/
|
|
14
|
+
client.emit(Events.GuildIntegrationsUpdate, guild);
|
|
15
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
|
|
2
|
+
import { Collection } from '@ovencord/collection';
|
|
3
|
+
import { Events } from '../../../util/Events.js';
|
|
4
|
+
|
|
5
|
+
module.exports = (client, { d: data }) => {
|
|
6
|
+
const guild = client.guilds.cache.get(data.guild_id);
|
|
7
|
+
if (!guild) return;
|
|
8
|
+
const members = new Collection();
|
|
9
|
+
|
|
10
|
+
for (const member of data.members) members.set(member.user.id, guild.members._add(member));
|
|
11
|
+
if (data.presences) {
|
|
12
|
+
for (const presence of data.presences) guild.presences._add(Object.assign(presence, { guild }));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the properties of a guild members chunk
|
|
17
|
+
*
|
|
18
|
+
* @typedef {Object} GuildMembersChunk
|
|
19
|
+
* @property {number} index Index of the received chunk
|
|
20
|
+
* @property {number} count Number of chunks the client should receive
|
|
21
|
+
* @property {Array<*>} notFound An array of whatever could not be found
|
|
22
|
+
* when using {@link GatewayOpcodes.RequestGuildMembers}
|
|
23
|
+
* @property {?string} nonce Nonce for this chunk
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Emitted whenever a chunk of guild members is received (all members come from the same guild).
|
|
28
|
+
*
|
|
29
|
+
* @event Client#guildMembersChunk
|
|
30
|
+
* @param {Collection<Snowflake, GuildMember>} members The members in the chunk
|
|
31
|
+
* @param {Guild} guild The guild related to the member chunk
|
|
32
|
+
* @param {GuildMembersChunk} chunk Properties of the received chunk
|
|
33
|
+
*/
|
|
34
|
+
client.emit(Events.GuildMembersChunk, members, guild, {
|
|
35
|
+
index: data.chunk_index,
|
|
36
|
+
count: data.chunk_count,
|
|
37
|
+
notFound: data.not_found,
|
|
38
|
+
nonce: data.nonce,
|
|
39
|
+
});
|
|
40
|
+
};
|