From ffe7cdbc6f140c09a429ce1d3334f91ff5c1bea7 Mon Sep 17 00:00:00 2001 From: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com> Date: Sat, 18 Jun 2022 18:46:37 -0400 Subject: [PATCH] feat: base plugin lib idea (#2308) * feat: base plugin lib idea * fix: stuff * fmt * fix: imports and exports * fix: errors & tests * fix: remove logs --- {util => gateway}/calculateShardId.ts | 2 +- gateway/manager/gatewayManager.ts | 10 +- gateway/manager/stop.ts | 2 +- gateway/shard/createShard.ts | 5 +- gateway/shard/handleMessage.ts | 2 +- gateway/shard/types.ts | 2 - mod.ts | 5 - bot.ts => plugins/bot/bot.ts | 199 ++++++++---------- plugins/bot/deps.ts | 1 + .../bot/handlers}/channels/CHANNEL_CREATE.ts | 4 +- .../bot/handlers}/channels/CHANNEL_DELETE.ts | 4 +- .../handlers}/channels/CHANNEL_PINS_UPDATE.ts | 4 +- .../bot/handlers}/channels/CHANNEL_UPDATE.ts | 4 +- .../channels/STAGE_INSTANCE_CREATE.ts | 4 +- .../channels/STAGE_INSTANCE_DELETE.ts | 4 +- .../channels/STAGE_INSTANCE_UPDATE.ts | 4 +- .../bot/handlers}/channels/THREAD_CREATE.ts | 2 +- .../bot/handlers}/channels/THREAD_DELETE.ts | 2 +- .../handlers}/channels/THREAD_LIST_SYNC.ts | 2 +- .../channels/THREAD_MEMBERS_UPDATE.ts | 2 +- .../channels/THREAD_MEMBER_UPDATE.ts | 2 +- .../bot/handlers}/channels/THREAD_UPDATE.ts | 2 +- .../bot/handlers}/channels/mod.ts | 0 .../handlers}/emojis/GUILD_EMOJIS_UPDATE.ts | 6 +- .../bot/handlers}/emojis/mod.ts | 0 .../bot/handlers}/guilds/GUILD_BAN_ADD.ts | 4 +- .../bot/handlers}/guilds/GUILD_BAN_REMOVE.ts | 4 +- .../bot/handlers}/guilds/GUILD_CREATE.ts | 4 +- .../bot/handlers}/guilds/GUILD_DELETE.ts | 4 +- .../guilds/GUILD_INTEGRATIONS_UPDATE.ts | 4 +- .../bot/handlers}/guilds/GUILD_LOADED_DD.ts | 4 +- .../bot/handlers}/guilds/GUILD_UPDATE.ts | 4 +- .../AUTO_MODERATION_ACTION_EXECUTION.ts | 4 +- .../automod/AUTO_MODERATION_RULE_CREATE.ts | 4 +- .../automod/AUTO_MODERATION_RULE_DELETE.ts | 4 +- .../automod/AUTO_MODERATION_RULE_UPDATE.ts | 4 +- .../bot/handlers}/guilds/automod/mod.ts | 0 .../bot/handlers}/guilds/mod.ts | 0 .../GUILD_SCHEDULED_EVENT_CREATE.ts | 4 +- .../GUILD_SCHEDULED_EVENT_DELETE.ts | 4 +- .../GUILD_SCHEDULED_EVENT_UPDATE.ts | 4 +- .../GUILD_SCHEDULED_EVENT_USER_ADD.ts | 4 +- .../GUILD_SCHEDULED_EVENT_USER_REMOVE.ts | 4 +- .../handlers}/guilds/scheduledEvents/mod.ts | 0 .../integrations/INTEGRATION_CREATE.ts | 2 +- .../integrations/INTEGRATION_DELETE.ts | 2 +- .../integrations/INTEGRATION_UPDATE.ts | 2 +- .../bot/handlers}/integrations/mod.ts | 0 .../interactions/INTERACTION_CREATE.ts | 2 +- .../bot/handlers}/interactions/mod.ts | 0 .../bot/handlers}/invites/INVITE_CREATE.ts | 2 +- .../bot/handlers}/invites/INVITE_DELETE.ts | 2 +- .../bot/handlers}/invites/mod.ts | 0 .../handlers}/members/GUILD_MEMBERS_CHUNK.ts | 2 +- .../bot/handlers}/members/GUILD_MEMBER_ADD.ts | 2 +- .../handlers}/members/GUILD_MEMBER_REMOVE.ts | 2 +- .../handlers}/members/GUILD_MEMBER_UPDATE.ts | 2 +- .../bot/handlers}/members/mod.ts | 0 .../bot/handlers}/messages/MESSAGE_CREATE.ts | 2 +- .../bot/handlers}/messages/MESSAGE_DELETE.ts | 2 +- .../handlers}/messages/MESSAGE_DELETE_BULK.ts | 2 +- .../messages/MESSAGE_REACTION_ADD.ts | 2 +- .../messages/MESSAGE_REACTION_REMOVE.ts | 2 +- .../messages/MESSAGE_REACTION_REMOVE_ALL.ts | 2 +- .../messages/MESSAGE_REACTION_REMOVE_EMOJI.ts | 2 +- .../bot/handlers}/messages/MESSAGE_UPDATE.ts | 2 +- .../bot/handlers}/messages/mod.ts | 0 .../bot/handlers}/misc/PRESENCE_UPDATE.ts | 2 +- .../bot/handlers}/misc/READY.ts | 2 +- .../bot/handlers}/misc/TYPING_START.ts | 2 +- .../bot/handlers}/misc/USER_UPDATE.ts | 2 +- .../bot/handlers}/misc/mod.ts | 0 {handlers => plugins/bot/handlers}/mod.ts | 0 .../bot/handlers}/roles/GUILD_ROLE_CREATE.ts | 2 +- .../bot/handlers}/roles/GUILD_ROLE_DELETE.ts | 2 +- .../bot/handlers}/roles/GUILD_ROLE_UPDATE.ts | 2 +- .../bot/handlers}/roles/mod.ts | 0 .../handlers}/voice/VOICE_SERVER_UPDATE.ts | 2 +- .../bot/handlers}/voice/VOICE_STATE_UPDATE.ts | 2 +- .../bot/handlers}/voice/mod.ts | 0 .../bot/handlers}/webhooks/WEBHOOKS_UPDATE.ts | 2 +- .../bot/handlers}/webhooks/mod.ts | 0 .../bot/helpers}/channels/createChannel.ts | 5 +- .../helpers}/channels/createStageInstance.ts | 4 +- .../bot/helpers}/channels/deleteChannel.ts | 4 +- .../channels/deleteChannelOverwrite.ts | 2 +- .../helpers}/channels/deleteStageInstance.ts | 2 +- .../bot/helpers}/channels/editChannel.ts | 5 +- .../helpers}/channels/editChannelOverwrite.ts | 4 +- .../bot/helpers}/channels/followChannel.ts | 4 +- .../channels/forums/createForumPost.ts | 6 +- .../bot/helpers}/channels/forums/mod.ts | 0 .../bot/helpers}/channels/getChannel.ts | 4 +- .../helpers}/channels/getChannelWebhooks.ts | 6 +- .../bot/helpers}/channels/getChannels.ts | 6 +- .../bot/helpers}/channels/getPins.ts | 4 +- .../bot/helpers}/channels/getStageInstance.ts | 4 +- .../bot/helpers}/channels/mod.ts | 0 .../bot/helpers}/channels/startTyping.ts | 2 +- .../bot/helpers}/channels/swapChannels.ts | 2 +- .../helpers}/channels/threads/addToThread.ts | 2 +- .../channels/threads/getActiveThreads.ts | 6 +- .../channels/threads/getArchivedThreads.ts | 6 +- .../channels/threads/getThreadMember.ts | 4 +- .../channels/threads/getThreadMembers.ts | 6 +- .../helpers}/channels/threads/joinThread.ts | 2 +- .../helpers}/channels/threads/leaveThread.ts | 2 +- .../bot/helpers}/channels/threads/mod.ts | 0 .../channels/threads/removeThreadMember.ts | 2 +- .../threads/startThreadWithMessage.ts | 4 +- .../threads/startThreadWithoutMessage.ts | 5 +- .../helpers}/channels/updateStageInstance.ts | 5 +- .../bot/helpers}/channels/updateVoiceState.ts | 2 +- .../discovery/addDiscoverySubcategory.ts | 4 +- .../bot/helpers}/discovery/editDiscovery.ts | 4 +- .../bot/helpers}/discovery/getDiscovery.ts | 4 +- .../discovery/getDiscoveryCategories.ts | 6 +- .../bot/helpers}/discovery/mod.ts | 0 .../discovery/removeDiscoverySubcategory.ts | 2 +- .../helpers}/discovery/validDiscoveryTerm.ts | 4 +- .../bot/helpers}/emojis/createEmoji.ts | 4 +- .../bot/helpers}/emojis/deleteEmoji.ts | 2 +- .../bot/helpers}/emojis/editEmoji.ts | 4 +- .../bot/helpers}/emojis/emojiUrl.ts | 0 .../bot/helpers}/emojis/getEmoji.ts | 4 +- .../bot/helpers}/emojis/getEmojis.ts | 6 +- .../bot/helpers}/emojis/mod.ts | 0 .../guilds/automod/createAutomodRule.ts | 2 +- .../guilds/automod/deleteAutomodRule.ts | 0 .../guilds/automod/editAutomodRule.ts | 2 +- .../helpers}/guilds/automod/getAutomodRule.ts | 4 +- .../guilds/automod/getAutomodRules.ts | 4 +- .../bot/helpers}/guilds/automod/mod.ts | 0 .../bot/helpers}/guilds/createGuild.ts | 6 +- .../bot/helpers}/guilds/deleteGuild.ts | 2 +- .../bot/helpers}/guilds/editGuild.ts | 6 +- .../bot/helpers}/guilds/editWelcomeScreen.ts | 4 +- .../bot/helpers}/guilds/editWidget.ts | 4 +- .../bot/helpers}/guilds/getAuditLogs.ts | 5 +- .../guilds/getAvailableVoiceRegions.ts | 6 +- .../bot/helpers}/guilds/getBan.ts | 4 +- .../bot/helpers}/guilds/getBans.ts | 6 +- .../bot/helpers}/guilds/getGuild.ts | 4 +- .../bot/helpers}/guilds/getGuildPreview.ts | 4 +- .../bot/helpers}/guilds/getPruneCount.ts | 2 +- .../bot/helpers}/guilds/getVanityUrl.ts | 4 +- .../bot/helpers}/guilds/getVoiceRegions.ts | 6 +- .../bot/helpers}/guilds/getWelcomeScreen.ts | 4 +- .../bot/helpers}/guilds/getWidget.ts | 4 +- .../bot/helpers}/guilds/getWidgetImageUrl.ts | 2 +- .../bot/helpers}/guilds/getWidgetSettings.ts | 4 +- .../bot/helpers}/guilds/guildBannerUrl.ts | 2 +- .../bot/helpers}/guilds/guildIconUrl.ts | 2 +- .../bot/helpers}/guilds/guildSplashUrl.ts | 2 +- .../bot/helpers}/guilds/leaveGuild.ts | 2 +- .../bot/helpers}/guilds/mod.ts | 0 .../scheduledEvents/createScheduledEvent.ts | 3 +- .../scheduledEvents/deleteScheduledEvent.ts | 0 .../scheduledEvents/editScheduledEvent.ts | 8 +- .../scheduledEvents/getScheduledEvent.ts | 2 +- .../scheduledEvents/getScheduledEventUsers.ts | 4 +- .../scheduledEvents/getScheduledEvents.ts | 4 +- .../helpers}/guilds/scheduledEvents/mod.ts | 0 .../integrations/deleteIntegration.ts | 2 +- .../helpers}/integrations/getIntegrations.ts | 6 +- .../bot/helpers}/integrations/mod.ts | 0 .../commands/createApplicationCommand.ts | 14 +- .../commands/deleteApplicationCommand.ts | 2 +- .../commands/deleteInteractionResponse.ts | 2 +- .../editApplicationCommandPermissions.ts | 5 +- .../commands/editInteractionResponse.ts | 4 +- .../commands/getApplicationCommand.ts | 4 +- .../getApplicationCommandPermission.ts | 4 +- .../getApplicationCommandPermissions.ts | 6 +- .../commands/getApplicationCommands.ts | 6 +- .../bot/helpers}/interactions/commands/mod.ts | 0 .../commands/upsertApplicationCommand.ts | 5 +- .../commands/upsertApplicationCommands.ts | 7 +- .../followups/deleteFollowupMessage.ts | 0 .../followups/editFollowupMessage.ts | 3 +- .../followups/getFollowupMessage.ts | 2 +- .../helpers}/interactions/followups/mod.ts | 0 .../getOriginalInteractionResponse.ts | 4 +- .../bot/helpers}/interactions/mod.ts | 0 .../interactions/sendInteractionResponse.ts | 9 +- .../helpers}/interactions/verifySignature.ts | 0 .../bot/helpers}/invites/createInvite.ts | 5 +- .../bot/helpers}/invites/deleteInvite.ts | 4 +- .../bot/helpers}/invites/getChannelInvites.ts | 6 +- .../bot/helpers}/invites/getInvite.ts | 4 +- .../bot/helpers}/invites/getInvites.ts | 6 +- .../bot/helpers}/invites/mod.ts | 0 .../bot/helpers}/members/avatarUrl.ts | 2 +- .../bot/helpers}/members/banMember.ts | 2 +- .../bot/helpers}/members/editBotNickname.ts | 2 +- .../bot/helpers}/members/editMember.ts | 4 +- .../bot/helpers}/members/fetchMembers.ts | 4 +- .../bot/helpers}/members/getDmChannel.ts | 4 +- .../bot/helpers}/members/getMember.ts | 4 +- .../bot/helpers}/members/getMembers.ts | 6 +- .../bot/helpers}/members/kickMember.ts | 0 .../bot/helpers}/members/mod.ts | 0 .../bot/helpers}/members/pruneMembers.ts | 2 +- .../bot/helpers}/members/searchMembers.ts | 6 +- .../bot/helpers}/members/unbanMember.ts | 2 +- .../bot/helpers}/messages/addReaction.ts | 2 +- .../bot/helpers}/messages/addReactions.ts | 2 +- .../bot/helpers}/messages/deleteMessage.ts | 2 +- .../bot/helpers}/messages/deleteMessages.ts | 2 +- .../bot/helpers}/messages/editMessage.ts | 7 +- .../bot/helpers}/messages/getMessage.ts | 4 +- .../bot/helpers}/messages/getMessages.ts | 6 +- .../bot/helpers}/messages/getReactions.ts | 6 +- .../bot/helpers}/messages/mod.ts | 0 .../bot/helpers}/messages/pinMessage.ts | 2 +- .../bot/helpers}/messages/publishMessage.ts | 4 +- .../helpers}/messages/removeAllReactions.ts | 2 +- .../bot/helpers}/messages/removeReaction.ts | 2 +- .../helpers}/messages/removeReactionEmoji.ts | 2 +- .../bot/helpers}/messages/sendMessage.ts | 7 +- .../bot/helpers}/messages/unpinMessage.ts | 2 +- .../bot/helpers}/misc/editBotProfile.ts | 4 +- .../bot/helpers}/misc/editBotStatus.ts | 0 .../bot/helpers}/misc/editShardStatus.ts | 4 +- .../bot/helpers}/misc/getGatewayBot.ts | 4 +- .../bot/helpers}/misc/getUser.ts | 4 +- {helpers => plugins/bot/helpers}/misc/mod.ts | 0 .../bot/helpers}/misc/nitroStickerPacks.ts | 2 +- {helpers => plugins/bot/helpers}/mod.ts | 0 .../bot/helpers}/oauth/getApplicationInfo.ts | 4 +- {helpers => plugins/bot/helpers}/oauth/mod.ts | 0 .../bot/helpers}/roles/addRole.ts | 2 +- .../bot/helpers}/roles/createRole.ts | 5 +- .../bot/helpers}/roles/deleteRole.ts | 2 +- .../bot/helpers}/roles/editRole.ts | 5 +- .../bot/helpers}/roles/getRoles.ts | 6 +- {helpers => plugins/bot/helpers}/roles/mod.ts | 0 .../bot/helpers}/roles/modifyRolePositions.ts | 4 +- .../bot/helpers}/roles/removeRole.ts | 2 +- .../templates/createGuildFromTemplate.ts | 4 +- .../helpers}/templates/createGuildTemplate.ts | 4 +- .../helpers}/templates/deleteGuildTemplate.ts | 4 +- .../helpers}/templates/editGuildTemplate.ts | 4 +- .../helpers}/templates/getGuildTemplates.ts | 6 +- .../bot/helpers}/templates/getTemplate.ts | 4 +- .../bot/helpers}/templates/mod.ts | 0 .../helpers}/templates/syncGuildTemplate.ts | 4 +- .../helpers}/voice/connectToVoiceChannel.ts | 4 +- {helpers => plugins/bot/helpers}/voice/mod.ts | 0 .../bot/helpers}/webhooks/createWebhook.ts | 4 +- .../bot/helpers}/webhooks/deleteWebhook.ts | 2 +- .../helpers}/webhooks/deleteWebhookMessage.ts | 2 +- .../webhooks/deleteWebhookWithToken.ts | 2 +- .../bot/helpers}/webhooks/editWebhook.ts | 4 +- .../helpers}/webhooks/editWebhookMessage.ts | 7 +- .../helpers}/webhooks/editWebhookWithToken.ts | 4 +- .../bot/helpers}/webhooks/getWebhook.ts | 4 +- .../helpers}/webhooks/getWebhookMessage.ts | 4 +- .../helpers}/webhooks/getWebhookWithToken.ts | 4 +- .../bot/helpers}/webhooks/getWebhooks.ts | 6 +- .../bot/helpers}/webhooks/mod.ts | 0 .../bot/helpers}/webhooks/sendWebhook.ts | 6 +- plugins/bot/mod.ts | 8 + .../bot/transformers}/activity.ts | 3 +- .../bot/transformers}/application.ts | 3 +- .../bot/transformers}/applicationCommand.ts | 3 +- .../transformers}/applicationCommandOption.ts | 4 +- .../applicationCommandOptionChoice.ts | 3 +- .../applicationCommandPermission.ts | 3 +- .../bot/transformers}/attachment.ts | 3 +- .../bot/transformers}/auditLogEntry.ts | 3 +- .../transformers}/automodActionExecution.ts | 3 +- .../bot/transformers}/automodRule.ts | 3 +- .../bot/transformers}/channel.ts | 3 +- .../bot/transformers}/component.ts | 4 +- .../bot/transformers}/embed.ts | 3 +- .../bot/transformers}/emoji.ts | 3 +- .../bot/transformers}/gatewayBot.ts | 3 +- .../bot/transformers}/guild.ts | 5 +- .../bot/transformers}/integration.ts | 3 +- .../bot/transformers}/interaction.ts | 8 +- .../bot/transformers}/invite.ts | 3 +- .../bot/transformers}/member.ts | 5 +- .../bot/transformers}/message.ts | 4 +- .../bot/transformers}/mod.ts | 0 .../bot/transformers}/presence.ts | 3 +- .../bot/transformers}/reverse/activity.ts | 2 +- .../transformers}/reverse/allowedMentions.ts | 4 +- .../bot/transformers}/reverse/application.ts | 2 +- .../bot/transformers}/reverse/component.ts | 2 +- .../bot/transformers}/reverse/embed.ts | 2 +- .../bot/transformers}/reverse/member.ts | 4 +- .../bot/transformers}/reverse/mod.ts | 0 .../bot/transformers}/reverse/team.ts | 2 +- .../bot/transformers}/role.ts | 3 +- .../bot/transformers}/scheduledEvent.ts | 3 +- .../bot/transformers}/stageInstance.ts | 3 +- .../bot/transformers}/sticker.ts | 3 +- .../bot/transformers}/team.ts | 3 +- .../bot/transformers}/template.ts | 3 +- .../bot/transformers}/threadMember.ts | 3 +- .../transformers}/toggles/ToggleBitfield.ts | 0 .../bot/transformers}/toggles/emoji.ts | 2 +- .../bot/transformers}/toggles/guild.ts | 5 +- .../bot/transformers}/toggles/member.ts | 2 +- .../bot/transformers}/toggles/mod.ts | 0 .../bot/transformers}/toggles/role.ts | 2 +- .../bot/transformers}/toggles/user.ts | 2 +- .../bot/transformers}/toggles/voice.ts | 2 +- .../bot/transformers}/voiceRegion.ts | 3 +- .../bot/transformers}/voiceState.ts | 3 +- .../bot/transformers}/webhook.ts | 3 +- .../bot/transformers}/welcomeScreen.ts | 3 +- .../bot/transformers}/widget.ts | 3 +- .../bot/transformers}/widgetSettings.ts | 3 +- types/discordeno.ts => plugins/bot/typings.ts | 9 +- {util => plugins/bot/util}/bigint.ts | 0 plugins/bot/util/collection.ts | 149 +++++++++++++ {util => plugins/bot/util}/hash.ts | 0 plugins/bot/util/mod.ts | 8 + {util => plugins/bot/util}/permissions.ts | 2 +- {util => plugins/bot/util}/routes.ts | 2 +- {util => plugins/bot/util}/urlToBase64.ts | 0 {util => plugins/bot/util}/utils.ts | 9 - {util => plugins/bot/util}/validateLength.ts | 0 rest/createRequestBody.ts | 2 +- rest/runMethod.ts | 6 +- tests/channels/deleteWithReason.test.ts | 7 +- tests/channels/deleteWithoutReason.test.ts | 7 +- tests/channels/messages/message.test.ts | 20 +- tests/guilds/events/events.test.ts | 7 +- tests/guilds/guild.test.ts | 25 ++- tests/guilds/members/bans.test.ts | 6 +- tests/mod.ts | 2 +- tests/rest.ts | 3 +- tests/utils.test.ts | 13 +- tests/webhook/deleteWebhook.test.ts | 8 +- tests/webhook/deleteWebhookWithToken.test.ts | 8 +- types/discord.ts | 7 + types/mod.ts | 1 - types/shared.ts | 25 +++ util/bucket.ts | 2 +- util/collection.ts | 49 ----- util/delay.ts | 8 + util/mod.ts | 8 +- 345 files changed, 809 insertions(+), 739 deletions(-) rename {util => gateway}/calculateShardId.ts (74%) rename bot.ts => plugins/bot/bot.ts (90%) create mode 100644 plugins/bot/deps.ts rename {handlers => plugins/bot/handlers}/channels/CHANNEL_CREATE.ts (64%) rename {handlers => plugins/bot/handlers}/channels/CHANNEL_DELETE.ts (75%) rename {handlers => plugins/bot/handlers}/channels/CHANNEL_PINS_UPDATE.ts (88%) rename {handlers => plugins/bot/handlers}/channels/CHANNEL_UPDATE.ts (66%) rename {handlers => plugins/bot/handlers}/channels/STAGE_INSTANCE_CREATE.ts (87%) rename {handlers => plugins/bot/handlers}/channels/STAGE_INSTANCE_DELETE.ts (87%) rename {handlers => plugins/bot/handlers}/channels/STAGE_INSTANCE_UPDATE.ts (87%) rename {handlers => plugins/bot/handlers}/channels/THREAD_CREATE.ts (75%) rename {handlers => plugins/bot/handlers}/channels/THREAD_DELETE.ts (75%) rename {handlers => plugins/bot/handlers}/channels/THREAD_LIST_SYNC.ts (97%) rename {handlers => plugins/bot/handlers}/channels/THREAD_MEMBERS_UPDATE.ts (95%) rename {handlers => plugins/bot/handlers}/channels/THREAD_MEMBER_UPDATE.ts (94%) rename {handlers => plugins/bot/handlers}/channels/THREAD_UPDATE.ts (75%) rename {handlers => plugins/bot/handlers}/channels/mod.ts (100%) rename {handlers => plugins/bot/handlers}/emojis/GUILD_EMOJIS_UPDATE.ts (77%) rename {handlers => plugins/bot/handlers}/emojis/mod.ts (100%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_BAN_ADD.ts (82%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_BAN_REMOVE.ts (83%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_CREATE.ts (71%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_DELETE.ts (81%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_INTEGRATIONS_UPDATE.ts (81%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_LOADED_DD.ts (72%) rename {handlers => plugins/bot/handlers}/guilds/GUILD_UPDATE.ts (71%) rename {handlers => plugins/bot/handlers}/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts (81%) rename {handlers => plugins/bot/handlers}/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts (82%) rename {handlers => plugins/bot/handlers}/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts (82%) rename {handlers => plugins/bot/handlers}/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts (82%) rename {handlers => plugins/bot/handlers}/guilds/automod/mod.ts (100%) rename {handlers => plugins/bot/handlers}/guilds/mod.ts (100%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts (81%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts (80%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts (80%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts (86%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts (85%) rename {handlers => plugins/bot/handlers}/guilds/scheduledEvents/mod.ts (100%) rename {handlers => plugins/bot/handlers}/integrations/INTEGRATION_CREATE.ts (90%) rename {handlers => plugins/bot/handlers}/integrations/INTEGRATION_DELETE.ts (95%) rename {handlers => plugins/bot/handlers}/integrations/INTEGRATION_UPDATE.ts (90%) rename {handlers => plugins/bot/handlers}/integrations/mod.ts (100%) rename {handlers => plugins/bot/handlers}/interactions/INTERACTION_CREATE.ts (95%) rename {handlers => plugins/bot/handlers}/interactions/mod.ts (100%) rename {handlers => plugins/bot/handlers}/invites/INVITE_CREATE.ts (92%) rename {handlers => plugins/bot/handlers}/invites/INVITE_DELETE.ts (96%) rename {handlers => plugins/bot/handlers}/invites/mod.ts (100%) rename {handlers => plugins/bot/handlers}/members/GUILD_MEMBERS_CHUNK.ts (98%) rename {handlers => plugins/bot/handlers}/members/GUILD_MEMBER_ADD.ts (95%) rename {handlers => plugins/bot/handlers}/members/GUILD_MEMBER_REMOVE.ts (94%) rename {handlers => plugins/bot/handlers}/members/GUILD_MEMBER_UPDATE.ts (94%) rename {handlers => plugins/bot/handlers}/members/mod.ts (100%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_CREATE.ts (75%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_DELETE.ts (95%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_DELETE_BULK.ts (96%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_REACTION_ADD.ts (96%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_REACTION_REMOVE.ts (95%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_REACTION_REMOVE_ALL.ts (94%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts (94%) rename {handlers => plugins/bot/handlers}/messages/MESSAGE_UPDATE.ts (77%) rename {handlers => plugins/bot/handlers}/messages/mod.ts (100%) rename {handlers => plugins/bot/handlers}/misc/PRESENCE_UPDATE.ts (92%) rename {handlers => plugins/bot/handlers}/misc/READY.ts (90%) rename {handlers => plugins/bot/handlers}/misc/TYPING_START.ts (97%) rename {handlers => plugins/bot/handlers}/misc/USER_UPDATE.ts (74%) rename {handlers => plugins/bot/handlers}/misc/mod.ts (100%) rename {handlers => plugins/bot/handlers}/mod.ts (100%) rename {handlers => plugins/bot/handlers}/roles/GUILD_ROLE_CREATE.ts (94%) rename {handlers => plugins/bot/handlers}/roles/GUILD_ROLE_DELETE.ts (94%) rename {handlers => plugins/bot/handlers}/roles/GUILD_ROLE_UPDATE.ts (94%) rename {handlers => plugins/bot/handlers}/roles/mod.ts (100%) rename {handlers => plugins/bot/handlers}/voice/VOICE_SERVER_UPDATE.ts (94%) rename {handlers => plugins/bot/handlers}/voice/VOICE_STATE_UPDATE.ts (95%) rename {handlers => plugins/bot/handlers}/voice/mod.ts (100%) rename {handlers => plugins/bot/handlers}/webhooks/WEBHOOKS_UPDATE.ts (94%) rename {handlers => plugins/bot/handlers}/webhooks/mod.ts (100%) rename {helpers => plugins/bot/helpers}/channels/createChannel.ts (94%) rename {helpers => plugins/bot/helpers}/channels/createStageInstance.ts (88%) rename {helpers => plugins/bot/helpers}/channels/deleteChannel.ts (80%) rename {helpers => plugins/bot/helpers}/channels/deleteChannelOverwrite.ts (89%) rename {helpers => plugins/bot/helpers}/channels/deleteStageInstance.ts (86%) rename {helpers => plugins/bot/helpers}/channels/editChannel.ts (97%) rename {helpers => plugins/bot/helpers}/channels/editChannelOverwrite.ts (90%) rename {helpers => plugins/bot/helpers}/channels/followChannel.ts (83%) rename {helpers => plugins/bot/helpers}/channels/forums/createForumPost.ts (92%) rename {helpers => plugins/bot/helpers}/channels/forums/mod.ts (100%) rename {helpers => plugins/bot/helpers}/channels/getChannel.ts (83%) rename {helpers => plugins/bot/helpers}/channels/getChannelWebhooks.ts (73%) rename {helpers => plugins/bot/helpers}/channels/getChannels.ts (71%) rename {helpers => plugins/bot/helpers}/channels/getPins.ts (76%) rename {helpers => plugins/bot/helpers}/channels/getStageInstance.ts (77%) rename {helpers => plugins/bot/helpers}/channels/mod.ts (100%) rename {helpers => plugins/bot/helpers}/channels/startTyping.ts (92%) rename {helpers => plugins/bot/helpers}/channels/swapChannels.ts (96%) rename {helpers => plugins/bot/helpers}/channels/threads/addToThread.ts (87%) rename {helpers => plugins/bot/helpers}/channels/threads/getActiveThreads.ts (80%) rename {helpers => plugins/bot/helpers}/channels/threads/getArchivedThreads.ts (88%) rename {helpers => plugins/bot/helpers}/channels/threads/getThreadMember.ts (83%) rename {helpers => plugins/bot/helpers}/channels/threads/getThreadMembers.ts (72%) rename {helpers => plugins/bot/helpers}/channels/threads/joinThread.ts (84%) rename {helpers => plugins/bot/helpers}/channels/threads/leaveThread.ts (84%) rename {helpers => plugins/bot/helpers}/channels/threads/mod.ts (100%) rename {helpers => plugins/bot/helpers}/channels/threads/removeThreadMember.ts (89%) rename {helpers => plugins/bot/helpers}/channels/threads/startThreadWithMessage.ts (90%) rename {helpers => plugins/bot/helpers}/channels/threads/startThreadWithoutMessage.ts (88%) rename {helpers => plugins/bot/helpers}/channels/updateStageInstance.ts (75%) rename {helpers => plugins/bot/helpers}/channels/updateVoiceState.ts (98%) rename {helpers => plugins/bot/helpers}/discovery/addDiscoverySubcategory.ts (74%) rename {helpers => plugins/bot/helpers}/discovery/editDiscovery.ts (93%) rename {helpers => plugins/bot/helpers}/discovery/getDiscovery.ts (88%) rename {helpers => plugins/bot/helpers}/discovery/getDiscoveryCategories.ts (74%) rename {helpers => plugins/bot/helpers}/discovery/mod.ts (100%) rename {helpers => plugins/bot/helpers}/discovery/removeDiscoverySubcategory.ts (90%) rename {helpers => plugins/bot/helpers}/discovery/validDiscoveryTerm.ts (68%) rename {helpers => plugins/bot/helpers}/emojis/createEmoji.ts (92%) rename {helpers => plugins/bot/helpers}/emojis/deleteEmoji.ts (88%) rename {helpers => plugins/bot/helpers}/emojis/editEmoji.ts (88%) rename {helpers => plugins/bot/helpers}/emojis/emojiUrl.ts (100%) rename {helpers => plugins/bot/helpers}/emojis/getEmoji.ts (77%) rename {helpers => plugins/bot/helpers}/emojis/getEmojis.ts (70%) rename {helpers => plugins/bot/helpers}/emojis/mod.ts (100%) rename {helpers => plugins/bot/helpers}/guilds/automod/createAutomodRule.ts (98%) rename {helpers => plugins/bot/helpers}/guilds/automod/deleteAutomodRule.ts (100%) rename {helpers => plugins/bot/helpers}/guilds/automod/editAutomodRule.ts (98%) rename {helpers => plugins/bot/helpers}/guilds/automod/getAutomodRule.ts (73%) rename {helpers => plugins/bot/helpers}/guilds/automod/getAutomodRules.ts (76%) rename {helpers => plugins/bot/helpers}/guilds/automod/mod.ts (100%) rename {helpers => plugins/bot/helpers}/guilds/createGuild.ts (94%) rename {helpers => plugins/bot/helpers}/guilds/deleteGuild.ts (87%) rename {helpers => plugins/bot/helpers}/guilds/editGuild.ts (96%) rename {helpers => plugins/bot/helpers}/guilds/editWelcomeScreen.ts (93%) rename {helpers => plugins/bot/helpers}/guilds/editWidget.ts (80%) rename {helpers => plugins/bot/helpers}/guilds/getAuditLogs.ts (94%) rename {helpers => plugins/bot/helpers}/guilds/getAvailableVoiceRegions.ts (74%) rename {helpers => plugins/bot/helpers}/guilds/getBan.ts (83%) rename {helpers => plugins/bot/helpers}/guilds/getBans.ts (85%) rename {helpers => plugins/bot/helpers}/guilds/getGuild.ts (87%) rename {helpers => plugins/bot/helpers}/guilds/getGuildPreview.ts (90%) rename {helpers => plugins/bot/helpers}/guilds/getPruneCount.ts (95%) rename {helpers => plugins/bot/helpers}/guilds/getVanityUrl.ts (80%) rename {helpers => plugins/bot/helpers}/guilds/getVoiceRegions.ts (76%) rename {helpers => plugins/bot/helpers}/guilds/getWelcomeScreen.ts (78%) rename {helpers => plugins/bot/helpers}/guilds/getWidget.ts (74%) rename {helpers => plugins/bot/helpers}/guilds/getWidgetImageUrl.ts (96%) rename {helpers => plugins/bot/helpers}/guilds/getWidgetSettings.ts (76%) rename {helpers => plugins/bot/helpers}/guilds/guildBannerUrl.ts (93%) rename {helpers => plugins/bot/helpers}/guilds/guildIconUrl.ts (93%) rename {helpers => plugins/bot/helpers}/guilds/guildSplashUrl.ts (93%) rename {helpers => plugins/bot/helpers}/guilds/leaveGuild.ts (82%) rename {helpers => plugins/bot/helpers}/guilds/mod.ts (100%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/createScheduledEvent.ts (94%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/deleteScheduledEvent.ts (100%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/editScheduledEvent.ts (93%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/getScheduledEvent.ts (87%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/getScheduledEventUsers.ts (94%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/getScheduledEvents.ts (85%) rename {helpers => plugins/bot/helpers}/guilds/scheduledEvents/mod.ts (100%) rename {helpers => plugins/bot/helpers}/integrations/deleteIntegration.ts (88%) rename {helpers => plugins/bot/helpers}/integrations/getIntegrations.ts (86%) rename {helpers => plugins/bot/helpers}/integrations/mod.ts (100%) rename {helpers => plugins/bot/helpers}/interactions/commands/createApplicationCommand.ts (93%) rename {helpers => plugins/bot/helpers}/interactions/commands/deleteApplicationCommand.ts (89%) rename {helpers => plugins/bot/helpers}/interactions/commands/deleteInteractionResponse.ts (92%) rename {helpers => plugins/bot/helpers}/interactions/commands/editApplicationCommandPermissions.ts (84%) rename {helpers => plugins/bot/helpers}/interactions/commands/editInteractionResponse.ts (97%) rename {helpers => plugins/bot/helpers}/interactions/commands/getApplicationCommand.ts (91%) rename {helpers => plugins/bot/helpers}/interactions/commands/getApplicationCommandPermission.ts (89%) rename {helpers => plugins/bot/helpers}/interactions/commands/getApplicationCommandPermissions.ts (83%) rename {helpers => plugins/bot/helpers}/interactions/commands/getApplicationCommands.ts (77%) rename {helpers => plugins/bot/helpers}/interactions/commands/mod.ts (100%) rename {helpers => plugins/bot/helpers}/interactions/commands/upsertApplicationCommand.ts (86%) rename {helpers => plugins/bot/helpers}/interactions/commands/upsertApplicationCommands.ts (86%) rename {helpers => plugins/bot/helpers}/interactions/followups/deleteFollowupMessage.ts (100%) rename {helpers => plugins/bot/helpers}/interactions/followups/editFollowupMessage.ts (96%) rename {helpers => plugins/bot/helpers}/interactions/followups/getFollowupMessage.ts (90%) rename {helpers => plugins/bot/helpers}/interactions/followups/mod.ts (100%) rename {helpers => plugins/bot/helpers}/interactions/getOriginalInteractionResponse.ts (80%) rename {helpers => plugins/bot/helpers}/interactions/mod.ts (100%) rename {helpers => plugins/bot/helpers}/interactions/sendInteractionResponse.ts (92%) rename {helpers => plugins/bot/helpers}/interactions/verifySignature.ts (100%) rename {helpers => plugins/bot/helpers}/invites/createInvite.ts (93%) rename {helpers => plugins/bot/helpers}/invites/deleteInvite.ts (72%) rename {helpers => plugins/bot/helpers}/invites/getChannelInvites.ts (77%) rename {helpers => plugins/bot/helpers}/invites/getInvite.ts (93%) rename {helpers => plugins/bot/helpers}/invites/getInvites.ts (77%) rename {helpers => plugins/bot/helpers}/invites/mod.ts (100%) rename {helpers => plugins/bot/helpers}/members/avatarUrl.ts (95%) rename {helpers => plugins/bot/helpers}/members/banMember.ts (94%) rename {helpers => plugins/bot/helpers}/members/editBotNickname.ts (90%) rename {helpers => plugins/bot/helpers}/members/editMember.ts (94%) rename {helpers => plugins/bot/helpers}/members/fetchMembers.ts (95%) rename {helpers => plugins/bot/helpers}/members/getDmChannel.ts (83%) rename {helpers => plugins/bot/helpers}/members/getMember.ts (78%) rename {helpers => plugins/bot/helpers}/members/getMembers.ts (86%) rename {helpers => plugins/bot/helpers}/members/kickMember.ts (100%) rename {helpers => plugins/bot/helpers}/members/mod.ts (100%) rename {helpers => plugins/bot/helpers}/members/pruneMembers.ts (97%) rename {helpers => plugins/bot/helpers}/members/searchMembers.ts (81%) rename {helpers => plugins/bot/helpers}/members/unbanMember.ts (85%) rename {helpers => plugins/bot/helpers}/messages/addReaction.ts (94%) rename {helpers => plugins/bot/helpers}/messages/addReactions.ts (94%) rename {helpers => plugins/bot/helpers}/messages/deleteMessage.ts (91%) rename {helpers => plugins/bot/helpers}/messages/deleteMessages.ts (93%) rename {helpers => plugins/bot/helpers}/messages/editMessage.ts (94%) rename {helpers => plugins/bot/helpers}/messages/getMessage.ts (81%) rename {helpers => plugins/bot/helpers}/messages/getMessages.ts (93%) rename {helpers => plugins/bot/helpers}/messages/getReactions.ts (86%) rename {helpers => plugins/bot/helpers}/messages/mod.ts (100%) rename {helpers => plugins/bot/helpers}/messages/pinMessage.ts (87%) rename {helpers => plugins/bot/helpers}/messages/publishMessage.ts (78%) rename {helpers => plugins/bot/helpers}/messages/removeAllReactions.ts (88%) rename {helpers => plugins/bot/helpers}/messages/removeReaction.ts (95%) rename {helpers => plugins/bot/helpers}/messages/removeReactionEmoji.ts (93%) rename {helpers => plugins/bot/helpers}/messages/sendMessage.ts (94%) rename {helpers => plugins/bot/helpers}/messages/unpinMessage.ts (86%) rename {helpers => plugins/bot/helpers}/misc/editBotProfile.ts (85%) rename {helpers => plugins/bot/helpers}/misc/editBotStatus.ts (100%) rename {helpers => plugins/bot/helpers}/misc/editShardStatus.ts (96%) rename {helpers => plugins/bot/helpers}/misc/getGatewayBot.ts (75%) rename {helpers => plugins/bot/helpers}/misc/getUser.ts (79%) rename {helpers => plugins/bot/helpers}/misc/mod.ts (100%) rename {helpers => plugins/bot/helpers}/misc/nitroStickerPacks.ts (86%) rename {helpers => plugins/bot/helpers}/mod.ts (100%) rename {helpers => plugins/bot/helpers}/oauth/getApplicationInfo.ts (73%) rename {helpers => plugins/bot/helpers}/oauth/mod.ts (100%) rename {helpers => plugins/bot/helpers}/roles/addRole.ts (88%) rename {helpers => plugins/bot/helpers}/roles/createRole.ts (89%) rename {helpers => plugins/bot/helpers}/roles/deleteRole.ts (85%) rename {helpers => plugins/bot/helpers}/roles/editRole.ts (88%) rename {helpers => plugins/bot/helpers}/roles/getRoles.ts (78%) rename {helpers => plugins/bot/helpers}/roles/mod.ts (100%) rename {helpers => plugins/bot/helpers}/roles/modifyRolePositions.ts (87%) rename {helpers => plugins/bot/helpers}/roles/removeRole.ts (88%) rename {helpers => plugins/bot/helpers}/templates/createGuildFromTemplate.ts (90%) rename {helpers => plugins/bot/helpers}/templates/createGuildTemplate.ts (88%) rename {helpers => plugins/bot/helpers}/templates/deleteGuildTemplate.ts (76%) rename {helpers => plugins/bot/helpers}/templates/editGuildTemplate.ts (91%) rename {helpers => plugins/bot/helpers}/templates/getGuildTemplates.ts (72%) rename {helpers => plugins/bot/helpers}/templates/getTemplate.ts (75%) rename {helpers => plugins/bot/helpers}/templates/mod.ts (100%) rename {helpers => plugins/bot/helpers}/templates/syncGuildTemplate.ts (77%) rename {helpers => plugins/bot/helpers}/voice/connectToVoiceChannel.ts (91%) rename {helpers => plugins/bot/helpers}/voice/mod.ts (100%) rename {helpers => plugins/bot/helpers}/webhooks/createWebhook.ts (91%) rename {helpers => plugins/bot/helpers}/webhooks/deleteWebhook.ts (88%) rename {helpers => plugins/bot/helpers}/webhooks/deleteWebhookMessage.ts (91%) rename {helpers => plugins/bot/helpers}/webhooks/deleteWebhookWithToken.ts (87%) rename {helpers => plugins/bot/helpers}/webhooks/editWebhook.ts (89%) rename {helpers => plugins/bot/helpers}/webhooks/editWebhookMessage.ts (94%) rename {helpers => plugins/bot/helpers}/webhooks/editWebhookWithToken.ts (84%) rename {helpers => plugins/bot/helpers}/webhooks/getWebhook.ts (77%) rename {helpers => plugins/bot/helpers}/webhooks/getWebhookMessage.ts (85%) rename {helpers => plugins/bot/helpers}/webhooks/getWebhookWithToken.ts (81%) rename {helpers => plugins/bot/helpers}/webhooks/getWebhooks.ts (73%) rename {helpers => plugins/bot/helpers}/webhooks/mod.ts (100%) rename {helpers => plugins/bot/helpers}/webhooks/sendWebhook.ts (92%) create mode 100644 plugins/bot/mod.ts rename {transformers => plugins/bot/transformers}/activity.ts (92%) rename {transformers => plugins/bot/transformers}/application.ts (91%) rename {transformers => plugins/bot/transformers}/applicationCommand.ts (90%) rename {transformers => plugins/bot/transformers}/applicationCommandOption.ts (89%) rename {transformers => plugins/bot/transformers}/applicationCommandOptionChoice.ts (77%) rename {transformers => plugins/bot/transformers}/applicationCommandPermission.ts (85%) rename {transformers => plugins/bot/transformers}/attachment.ts (84%) rename {transformers => plugins/bot/transformers}/auditLogEntry.ts (97%) rename {transformers => plugins/bot/transformers}/automodActionExecution.ts (91%) rename {transformers => plugins/bot/transformers}/automodRule.ts (91%) rename {transformers => plugins/bot/transformers}/channel.ts (97%) rename {transformers => plugins/bot/transformers}/component.ts (94%) rename {transformers => plugins/bot/transformers}/embed.ts (93%) rename {transformers => plugins/bot/transformers}/emoji.ts (85%) rename {transformers => plugins/bot/transformers}/gatewayBot.ts (83%) rename {transformers => plugins/bot/transformers}/guild.ts (96%) rename {transformers => plugins/bot/transformers}/integration.ts (92%) rename {transformers => plugins/bot/transformers}/interaction.ts (96%) rename {transformers => plugins/bot/transformers}/invite.ts (94%) rename {transformers => plugins/bot/transformers}/member.ts (91%) rename {transformers => plugins/bot/transformers}/message.ts (96%) rename {transformers => plugins/bot/transformers}/mod.ts (100%) rename {transformers => plugins/bot/transformers}/presence.ts (92%) rename {transformers => plugins/bot/transformers}/reverse/activity.ts (95%) rename {transformers => plugins/bot/transformers}/reverse/allowedMentions.ts (69%) rename {transformers => plugins/bot/transformers}/reverse/application.ts (94%) rename {transformers => plugins/bot/transformers}/reverse/component.ts (95%) rename {transformers => plugins/bot/transformers}/reverse/embed.ts (96%) rename {transformers => plugins/bot/transformers}/reverse/member.ts (93%) rename {transformers => plugins/bot/transformers}/reverse/mod.ts (100%) rename {transformers => plugins/bot/transformers}/reverse/team.ts (92%) rename {transformers => plugins/bot/transformers}/role.ts (90%) rename {transformers => plugins/bot/transformers}/scheduledEvent.ts (92%) rename {transformers => plugins/bot/transformers}/stageInstance.ts (85%) rename {transformers => plugins/bot/transformers}/sticker.ts (92%) rename {transformers => plugins/bot/transformers}/team.ts (87%) rename {transformers => plugins/bot/transformers}/template.ts (88%) rename {transformers => plugins/bot/transformers}/threadMember.ts (85%) rename {transformers => plugins/bot/transformers}/toggles/ToggleBitfield.ts (100%) rename {transformers => plugins/bot/transformers}/toggles/emoji.ts (96%) rename {transformers => plugins/bot/transformers}/toggles/guild.ts (98%) rename {transformers => plugins/bot/transformers}/toggles/member.ts (95%) rename {transformers => plugins/bot/transformers}/toggles/mod.ts (100%) rename {transformers => plugins/bot/transformers}/toggles/role.ts (97%) rename {transformers => plugins/bot/transformers}/toggles/user.ts (97%) rename {transformers => plugins/bot/transformers}/toggles/voice.ts (97%) rename {transformers => plugins/bot/transformers}/voiceRegion.ts (79%) rename {transformers => plugins/bot/transformers}/voiceState.ts (90%) rename {transformers => plugins/bot/transformers}/webhook.ts (93%) rename {transformers => plugins/bot/transformers}/welcomeScreen.ts (85%) rename {transformers => plugins/bot/transformers}/widget.ts (89%) rename {transformers => plugins/bot/transformers}/widgetSettings.ts (75%) rename types/discordeno.ts => plugins/bot/typings.ts (96%) rename {util => plugins/bot/util}/bigint.ts (100%) create mode 100644 plugins/bot/util/collection.ts rename {util => plugins/bot/util}/hash.ts (100%) create mode 100644 plugins/bot/util/mod.ts rename {util => plugins/bot/util}/permissions.ts (91%) rename {util => plugins/bot/util}/routes.ts (99%) rename {util => plugins/bot/util}/urlToBase64.ts (100%) rename {util => plugins/bot/util}/utils.ts (76%) rename {util => plugins/bot/util}/validateLength.ts (100%) create mode 100644 util/delay.ts diff --git a/util/calculateShardId.ts b/gateway/calculateShardId.ts similarity index 74% rename from util/calculateShardId.ts rename to gateway/calculateShardId.ts index 820d2124e..d07c1a4e5 100644 --- a/util/calculateShardId.ts +++ b/gateway/calculateShardId.ts @@ -1,4 +1,4 @@ -import { GatewayManager } from "../gateway/manager/gatewayManager.ts"; +import { GatewayManager } from "./manager/gatewayManager.ts"; export function calculateShardId(gateway: GatewayManager, guildId: bigint) { if (gateway.manager.totalShards === 1) return 0; diff --git a/gateway/manager/gatewayManager.ts b/gateway/manager/gatewayManager.ts index 8507b9aa2..bcaa8a319 100644 --- a/gateway/manager/gatewayManager.ts +++ b/gateway/manager/gatewayManager.ts @@ -1,8 +1,6 @@ -import { GetGatewayBot } from "../../transformers/gatewayBot.ts"; import { DiscordGatewayPayload } from "../../types/discord.ts"; -import { GatewayIntents, MakeRequired, OmitFirstFnArg, PickPartial } from "../../types/shared.ts"; +import { GatewayBot, PickPartial } from "../../types/shared.ts"; import { LeakyBucket } from "../../util/bucket.ts"; -import { Collection } from "../../util/collection.ts"; import { CreateShard, createShard } from "../shard/createShard.ts"; import { Shard, ShardGatewayConfig } from "../shard/types.ts"; import { calculateTotalShards } from "./calculateTotalShards.ts"; @@ -48,7 +46,7 @@ export function createGatewayManager( /** The max concurrency buckets. * Those will be created when the `spawnShards` (which calls `prepareBuckets` under the hood) function gets called. */ - buckets: new Collection< + buckets: new Map< number, { workers: { id: number; queue: number[] }[]; @@ -222,7 +220,7 @@ export interface CreateGatewayManager { lastShardId: number; /** Important data which is used by the manager to connect shards to the gateway. */ - gatewayBot: GetGatewayBot; + gatewayBot: GatewayBot; gatewayConfig: PickPartial; @@ -230,7 +228,7 @@ export interface CreateGatewayManager { createShardOptions?: Omit; /** Stored as bucketId: { workers: [workerId, [ShardIds]], createNextShard: boolean } */ - buckets: Collection< + buckets: Map< number, { workers: { id: number; queue: number[] }[]; diff --git a/gateway/manager/stop.ts b/gateway/manager/stop.ts index 99508b0da..e852de265 100644 --- a/gateway/manager/stop.ts +++ b/gateway/manager/stop.ts @@ -1,4 +1,4 @@ -import { delay } from "../../util/utils.ts"; +import { delay } from "../../util/delay.ts"; import { GatewayManager } from "./gatewayManager.ts"; export async function stop(gateway: GatewayManager, code: number, reason: string) { diff --git a/gateway/shard/createShard.ts b/gateway/shard/createShard.ts index 63752f1a1..359517431 100644 --- a/gateway/shard/createShard.ts +++ b/gateway/shard/createShard.ts @@ -12,7 +12,6 @@ import { ShardSocketRequest, ShardState, } from "./types.ts"; -import { StatusUpdate } from "../../helpers/misc/editShardStatus.ts"; import { startHeartbeating } from "./startHeartbeating.ts"; import { stopHeartbeating } from "./stopHeartbeating.ts"; import { resume } from "./resume.ts"; @@ -24,7 +23,7 @@ import { connect } from "./connect.ts"; import { close } from "./close.ts"; import { shutdown } from "./shutdown.ts"; import { isOpen } from "./isOpen.ts"; -import { DiscordGatewayPayload } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordStatusUpdate } from "../../types/discord.ts"; import { GatewayIntents, PickPartial } from "../../types/shared.ts"; import { API_VERSION } from "../../util/constants.ts"; @@ -275,7 +274,7 @@ export interface CreateShard { isOpen?: typeof isOpen; /** Function which can be overwritten in order to get the shards presence. */ - makePresence?(shardId: number): Promise | StatusUpdate; + makePresence?(shardId: number): Promise | DiscordStatusUpdate; /** The maximum of requests which can be send to discord per rate limit tick. * Typically this value should not be changed. diff --git a/gateway/shard/handleMessage.ts b/gateway/shard/handleMessage.ts index a50c9e8db..f1042d263 100644 --- a/gateway/shard/handleMessage.ts +++ b/gateway/shard/handleMessage.ts @@ -1,7 +1,7 @@ import { DiscordGatewayPayload, DiscordHello, DiscordReady } from "../../types/discord.ts"; import { GatewayOpcodes } from "../../types/shared.ts"; import { createLeakyBucket } from "../../util/bucket.ts"; -import { delay } from "../../util/utils.ts"; +import { delay } from "../../util/delay.ts"; import { decompressWith } from "./deps.ts"; import { GATEWAY_RATE_LIMIT_RESET_INTERVAL, Shard, ShardState } from "./types.ts"; diff --git a/gateway/shard/types.ts b/gateway/shard/types.ts index a9e326ded..d7dc06ee1 100644 --- a/gateway/shard/types.ts +++ b/gateway/shard/types.ts @@ -1,7 +1,5 @@ -import { StatusUpdate } from "../../helpers/misc/editShardStatus.ts"; import { DiscordGatewayPayload } from "../../types/discord.ts"; import { GatewayOpcodes } from "../../types/shared.ts"; -import { LeakyBucket } from "../../util/bucket.ts"; import { createShard } from "./createShard.ts"; // TODO: think whether we also need an identifiedShard function diff --git a/mod.ts b/mod.ts index cdf461342..4956aa28d 100644 --- a/mod.ts +++ b/mod.ts @@ -1,9 +1,4 @@ export * from "./gateway/mod.ts"; -export * from "./handlers/mod.ts"; -export * from "./helpers/mod.ts"; export * from "./rest/mod.ts"; -export * from "./transformers/mod.ts"; export * from "./types/mod.ts"; export * from "./util/mod.ts"; - -export * from "./bot.ts"; diff --git a/bot.ts b/plugins/bot/bot.ts similarity index 90% rename from bot.ts rename to plugins/bot/bot.ts index ce19dd5f2..0af267aa0 100644 --- a/bot.ts +++ b/plugins/bot/bot.ts @@ -1,97 +1,32 @@ -import { createRestManager, CreateRestManagerOptions } from "./rest/mod.ts"; -import { bigintToSnowflake, snowflakeToBigint } from "./util/bigint.ts"; -import { Collection } from "./util/collection.ts"; -import { - Channel, - Guild, - Member, - Message, - Role, - ScheduledEvent, - Template, - transformChannel, - transformGuild, - transformMember, - transformMessage, - transformRole, - transformTemplate, - transformUser, - transformVoiceState, - User, - VoiceState, -} from "./transformers/mod.ts"; +import * as handlers from "./handlers/mod.ts"; +import * as helpers from "./helpers/mod.ts"; +import { calculateShardId } from "../../gateway/calculateShardId.ts"; import { baseEndpoints, CHANNEL_MENTION_REGEX, CONTEXT_MENU_COMMANDS_NAME_REGEX, + createGatewayManager, + createRestManager, + CreateRestManagerOptions, + CreateShardManager, + delay, DISCORD_SNOWFLAKE_REGEX, - DISCORDENO_VERSION, - SLASH_COMMANDS_NAME_REGEX, - USER_AGENT, -} from "./util/constants.ts"; -import { createGatewayManager, GatewayManager } from "./gateway/manager/gatewayManager.ts"; -import { validateLength } from "./util/validateLength.ts"; -import { delay, formatImageURL } from "./util/utils.ts"; -import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts"; -import { calculateShardId } from "./util/calculateShardId.ts"; -import * as handlers from "./handlers/mod.ts"; -import { - Interaction, - InteractionDataOption, - transformInteraction, - transformInteractionDataOption, -} from "./transformers/interaction.ts"; -import { Integration, transformIntegration } from "./transformers/integration.ts"; -import { transformApplication } from "./transformers/application.ts"; -import { transformTeam } from "./transformers/team.ts"; -import { Invite, transformInvite } from "./transformers/invite.ts"; -import * as helpers from "./helpers/mod.ts"; -import { Emoji, transformEmoji } from "./transformers/emoji.ts"; -import { transformActivity } from "./transformers/activity.ts"; -import { PresenceUpdate, transformPresence } from "./transformers/presence.ts"; -import { urlToBase64 } from "./util/urlToBase64.ts"; -import { transformAttachment } from "./transformers/attachment.ts"; -import { transformEmbed } from "./transformers/embed.ts"; -import { transformComponent } from "./transformers/component.ts"; -import { transformWebhook } from "./transformers/webhook.ts"; -import { transformAuditLogEntry } from "./transformers/auditLogEntry.ts"; -import { transformApplicationCommandPermission } from "./transformers/applicationCommandPermission.ts"; -import { calculateBits, calculatePermissions } from "./util/permissions.ts"; -import { transformScheduledEvent } from "./transformers/scheduledEvent.ts"; -import { ThreadMember, transformThreadMember } from "./transformers/threadMember.ts"; -import { transformApplicationCommandOption } from "./transformers/applicationCommandOption.ts"; -import { transformApplicationCommand } from "./transformers/applicationCommand.ts"; -import { transformWelcomeScreen } from "./transformers/welcomeScreen.ts"; -import { transformVoiceRegion } from "./transformers/voiceRegion.ts"; -import { transformWidget } from "./transformers/widget.ts"; -import { transformWidgetSettings } from "./transformers/widgetSettings.ts"; -import { transformStageInstance } from "./transformers/stageInstance.ts"; -import { StickerPack, transformSticker, transformStickerPack } from "./transformers/sticker.ts"; -import { GetGatewayBot, transformGatewayBot } from "./transformers/gatewayBot.ts"; -import { - DiscordAllowedMentions, - DiscordApplicationCommandOptionChoice, - DiscordAutoModerationActionExecution, - DiscordAutoModerationRule, - DiscordEmoji, - DiscordGatewayPayload, - DiscordInteractionDataOption, - DiscordReady, - DiscordStickerPack, - DiscordTemplate, -} from "./types/discord.ts"; -import { Errors, GatewayDispatchEventNames, GatewayIntents } from "./types/shared.ts"; - -import { DiscordActivity, + DiscordAllowedMentions, DiscordApplication, DiscordApplicationCommand, DiscordApplicationCommandOption, + DiscordApplicationCommandOptionChoice, DiscordAttachment, DiscordAuditLogEntry, + DiscordAutoModerationActionExecution, + DiscordAutoModerationRule, DiscordChannel, DiscordComponent, DiscordEmbed, + DiscordEmoji, + DISCORDENO_VERSION, + DiscordGatewayPayload, DiscordGetGatewayBot, DiscordGuild, DiscordGuildApplicationCommandPermissions, @@ -99,60 +34,101 @@ import { DiscordGuildWidgetSettings, DiscordIntegrationCreateUpdate, DiscordInteraction, + DiscordInteractionDataOption, DiscordInviteCreate, DiscordMember, DiscordMessage, DiscordPresenceUpdate, + DiscordReady, DiscordRole, DiscordScheduledEvent, DiscordStageInstance, DiscordSticker, + DiscordStickerPack, DiscordTeam, + DiscordTemplate, DiscordThreadMember, DiscordUser, DiscordVoiceRegion, DiscordVoiceState, DiscordWebhook, DiscordWelcomeScreen, -} from "./types/discord.ts"; - -import { Application } from "./transformers/application.ts"; -import { Team } from "./transformers/team.ts"; -import { Activity } from "./transformers/activity.ts"; -import { Attachment } from "./transformers/attachment.ts"; -import { Embed } from "./transformers/embed.ts"; -import { Webhook } from "./transformers/webhook.ts"; -import { Component } from "./transformers/component.ts"; -import { ApplicationCommand } from "./transformers/applicationCommand.ts"; -import { AuditLogEntry } from "./transformers/auditLogEntry.ts"; -import { ApplicationCommandOption } from "./transformers/applicationCommandOption.ts"; -import { ApplicationCommandPermission } from "./transformers/applicationCommandPermission.ts"; -import { WelcomeScreen } from "./transformers/welcomeScreen.ts"; -import { VoiceRegions } from "./transformers/voiceRegion.ts"; -import { GuildWidget } from "./transformers/widget.ts"; -import { GuildWidgetSettings } from "./transformers/widgetSettings.ts"; -import { StageInstance } from "./transformers/stageInstance.ts"; -import { Sticker } from "./transformers/sticker.ts"; + Errors, + GatewayDispatchEventNames, + GatewayIntents, + getBotIdFromToken, + removeTokenPrefix, + SLASH_COMMANDS_NAME_REGEX, + USER_AGENT, +} from "./deps.ts"; +import { Activity, transformActivity } from "./transformers/activity.ts"; +import { Application, transformApplication } from "./transformers/application.ts"; +import { ApplicationCommand, transformApplicationCommand } from "./transformers/applicationCommand.ts"; +import { + ApplicationCommandOption, + transformApplicationCommandOption, +} from "./transformers/applicationCommandOption.ts"; import { ApplicationCommandOptionChoice, transformApplicationCommandOptionChoice, } from "./transformers/applicationCommandOptionChoice.ts"; -import { transformEmbedToDiscordEmbed } from "./transformers/reverse/embed.ts"; -import { transformComponentToDiscordComponent } from "./transformers/reverse/component.ts"; -import { transformActivityToDiscordActivity } from "./transformers/reverse/activity.ts"; -import { transformTeamToDiscordTeam } from "./transformers/reverse/team.ts"; -import { transformMemberToDiscordMember, transformUserToDiscordUser } from "./transformers/reverse/member.ts"; -import { transformApplicationToDiscordApplication } from "./transformers/reverse/application.ts"; -import { getBotIdFromToken, removeTokenPrefix } from "./util/token.ts"; -import { CreateShardManager } from "./gateway/manager/shardManager.ts"; -import { AutoModerationRule, transformAutoModerationRule } from "./transformers/automodRule.ts"; +import { + ApplicationCommandPermission, + transformApplicationCommandPermission, +} from "./transformers/applicationCommandPermission.ts"; +import { Attachment, transformAttachment } from "./transformers/attachment.ts"; +import { AuditLogEntry, transformAuditLogEntry } from "./transformers/auditLogEntry.ts"; import { AutoModerationActionExecution, transformAutoModerationActionExecution, } from "./transformers/automodActionExecution.ts"; -import { routes } from "./util/routes.ts"; +import { AutoModerationRule, transformAutoModerationRule } from "./transformers/automodRule.ts"; +import { Channel, transformChannel } from "./transformers/channel.ts"; +import { Component, transformComponent } from "./transformers/component.ts"; +import { Embed, transformEmbed } from "./transformers/embed.ts"; +import { Emoji, transformEmoji } from "./transformers/emoji.ts"; +import { GetGatewayBot, transformGatewayBot } from "./transformers/gatewayBot.ts"; +import { Guild, transformGuild } from "./transformers/guild.ts"; +import { Integration, transformIntegration } from "./transformers/integration.ts"; +import { + Interaction, + InteractionDataOption, + transformInteraction, + transformInteractionDataOption, +} from "./transformers/interaction.ts"; +import { Invite, transformInvite } from "./transformers/invite.ts"; +import { Member, transformMember, transformUser, User } from "./transformers/member.ts"; +import { Message, transformMessage } from "./transformers/message.ts"; +import { PresenceUpdate, transformPresence } from "./transformers/presence.ts"; +import { transformActivityToDiscordActivity } from "./transformers/reverse/activity.ts"; import { transformAllowedMentionsToDiscordAllowedMentions } from "./transformers/reverse/allowedMentions.ts"; -import { AllowedMentions } from "./mod.ts"; +import { transformApplicationToDiscordApplication } from "./transformers/reverse/application.ts"; +import { transformComponentToDiscordComponent } from "./transformers/reverse/component.ts"; +import { transformEmbedToDiscordEmbed } from "./transformers/reverse/embed.ts"; +import { transformMemberToDiscordMember, transformUserToDiscordUser } from "./transformers/reverse/member.ts"; +import { transformTeamToDiscordTeam } from "./transformers/reverse/team.ts"; +import { Role, transformRole } from "./transformers/role.ts"; +import { ScheduledEvent, transformScheduledEvent } from "./transformers/scheduledEvent.ts"; +import { StageInstance, transformStageInstance } from "./transformers/stageInstance.ts"; +import { Sticker, StickerPack, transformSticker, transformStickerPack } from "./transformers/sticker.ts"; +import { Team, transformTeam } from "./transformers/team.ts"; +import { Template, transformTemplate } from "./transformers/template.ts"; +import { ThreadMember, transformThreadMember } from "./transformers/threadMember.ts"; +import { transformVoiceRegion, VoiceRegions } from "./transformers/voiceRegion.ts"; +import { transformVoiceState, VoiceState } from "./transformers/voiceState.ts"; +import { transformWebhook, Webhook } from "./transformers/webhook.ts"; +import { transformWelcomeScreen, WelcomeScreen } from "./transformers/welcomeScreen.ts"; +import { GuildWidget, transformWidget } from "./transformers/widget.ts"; +import { GuildWidgetSettings, transformWidgetSettings } from "./transformers/widgetSettings.ts"; +import { AllowedMentions } from "./typings.ts"; +import { bigintToSnowflake, snowflakeToBigint } from "./util/bigint.ts"; +import { BotCollection } from "./util/collection.ts"; +import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts"; +import { calculateBits, calculatePermissions } from "./util/permissions.ts"; +import { routes } from "./util/routes.ts"; +import { urlToBase64 } from "./util/urlToBase64.ts"; +import { formatImageURL } from "./util/utils.ts"; +import { validateLength } from "./util/validateLength.ts"; export function createBot(options: CreateBotOptions): Bot { const bot = { @@ -306,7 +282,6 @@ export function createUtils(options: Partial) { export interface HelperUtils { snowflakeToBigint: typeof snowflakeToBigint; bigintToSnowflake: typeof bigintToSnowflake; - calculateShardId: typeof calculateShardId; delay: typeof delay; iconHashToBigInt: typeof iconHashToBigInt; iconBigintToHash: typeof iconBigintToHash; @@ -706,7 +681,7 @@ export interface EventHandlers { bot: Bot, payload: { guildId: bigint; - emojis: Collection; + emojis: BotCollection; }, ) => unknown; guildBanAdd: (bot: Bot, user: User, guildId: bigint) => unknown; diff --git a/plugins/bot/deps.ts b/plugins/bot/deps.ts new file mode 100644 index 000000000..ac326e73f --- /dev/null +++ b/plugins/bot/deps.ts @@ -0,0 +1 @@ +export * from "../../mod.ts"; diff --git a/handlers/channels/CHANNEL_CREATE.ts b/plugins/bot/handlers/channels/CHANNEL_CREATE.ts similarity index 64% rename from handlers/channels/CHANNEL_CREATE.ts rename to plugins/bot/handlers/channels/CHANNEL_CREATE.ts index f7a8c690f..ed50c66c2 100644 --- a/handlers/channels/CHANNEL_CREATE.ts +++ b/plugins/bot/handlers/channels/CHANNEL_CREATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleChannelCreate(bot: Bot, payload: DiscordGatewayPayload) { const channel = bot.transformers.channel(bot, { channel: payload.d as DiscordChannel }); diff --git a/handlers/channels/CHANNEL_DELETE.ts b/plugins/bot/handlers/channels/CHANNEL_DELETE.ts similarity index 75% rename from handlers/channels/CHANNEL_DELETE.ts rename to plugins/bot/handlers/channels/CHANNEL_DELETE.ts index fb6c7be9b..8f1684f5d 100644 --- a/handlers/channels/CHANNEL_DELETE.ts +++ b/plugins/bot/handlers/channels/CHANNEL_DELETE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleChannelDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannel; diff --git a/handlers/channels/CHANNEL_PINS_UPDATE.ts b/plugins/bot/handlers/channels/CHANNEL_PINS_UPDATE.ts similarity index 88% rename from handlers/channels/CHANNEL_PINS_UPDATE.ts rename to plugins/bot/handlers/channels/CHANNEL_PINS_UPDATE.ts index 7361a44e5..208a7f19a 100644 --- a/handlers/channels/CHANNEL_PINS_UPDATE.ts +++ b/plugins/bot/handlers/channels/CHANNEL_PINS_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannelPinsUpdate, DiscordGatewayPayload } from "../../deps.ts"; export async function handleChannelPinsUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannelPinsUpdate; diff --git a/handlers/channels/CHANNEL_UPDATE.ts b/plugins/bot/handlers/channels/CHANNEL_UPDATE.ts similarity index 66% rename from handlers/channels/CHANNEL_UPDATE.ts rename to plugins/bot/handlers/channels/CHANNEL_UPDATE.ts index 6933f0b7a..2c97f30cb 100644 --- a/handlers/channels/CHANNEL_UPDATE.ts +++ b/plugins/bot/handlers/channels/CHANNEL_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleChannelUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannel; diff --git a/handlers/channels/STAGE_INSTANCE_CREATE.ts b/plugins/bot/handlers/channels/STAGE_INSTANCE_CREATE.ts similarity index 87% rename from handlers/channels/STAGE_INSTANCE_CREATE.ts rename to plugins/bot/handlers/channels/STAGE_INSTANCE_CREATE.ts index e2c2ac58a..53f49ee0f 100644 --- a/handlers/channels/STAGE_INSTANCE_CREATE.ts +++ b/plugins/bot/handlers/channels/STAGE_INSTANCE_CREATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts"; export function handleStageInstanceCreate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordStageInstance; diff --git a/handlers/channels/STAGE_INSTANCE_DELETE.ts b/plugins/bot/handlers/channels/STAGE_INSTANCE_DELETE.ts similarity index 87% rename from handlers/channels/STAGE_INSTANCE_DELETE.ts rename to plugins/bot/handlers/channels/STAGE_INSTANCE_DELETE.ts index b98f27008..af8d5dacf 100644 --- a/handlers/channels/STAGE_INSTANCE_DELETE.ts +++ b/plugins/bot/handlers/channels/STAGE_INSTANCE_DELETE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts"; export function handleStageInstanceDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordStageInstance; diff --git a/handlers/channels/STAGE_INSTANCE_UPDATE.ts b/plugins/bot/handlers/channels/STAGE_INSTANCE_UPDATE.ts similarity index 87% rename from handlers/channels/STAGE_INSTANCE_UPDATE.ts rename to plugins/bot/handlers/channels/STAGE_INSTANCE_UPDATE.ts index 0685127fc..69c55a45b 100644 --- a/handlers/channels/STAGE_INSTANCE_UPDATE.ts +++ b/plugins/bot/handlers/channels/STAGE_INSTANCE_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordStageInstance } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordStageInstance } from "../../deps.ts"; export function handleStageInstanceUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordStageInstance; diff --git a/handlers/channels/THREAD_CREATE.ts b/plugins/bot/handlers/channels/THREAD_CREATE.ts similarity index 75% rename from handlers/channels/THREAD_CREATE.ts rename to plugins/bot/handlers/channels/THREAD_CREATE.ts index a13d1247b..823f7c59c 100644 --- a/handlers/channels/THREAD_CREATE.ts +++ b/plugins/bot/handlers/channels/THREAD_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleThreadCreate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannel; diff --git a/handlers/channels/THREAD_DELETE.ts b/plugins/bot/handlers/channels/THREAD_DELETE.ts similarity index 75% rename from handlers/channels/THREAD_DELETE.ts rename to plugins/bot/handlers/channels/THREAD_DELETE.ts index 9b9755752..60c0906b6 100644 --- a/handlers/channels/THREAD_DELETE.ts +++ b/plugins/bot/handlers/channels/THREAD_DELETE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleThreadDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannel; diff --git a/handlers/channels/THREAD_LIST_SYNC.ts b/plugins/bot/handlers/channels/THREAD_LIST_SYNC.ts similarity index 97% rename from handlers/channels/THREAD_LIST_SYNC.ts rename to plugins/bot/handlers/channels/THREAD_LIST_SYNC.ts index b476e1385..c6d0c2ba4 100644 --- a/handlers/channels/THREAD_LIST_SYNC.ts +++ b/plugins/bot/handlers/channels/THREAD_LIST_SYNC.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordThreadListSync } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordThreadListSync } from "../../deps.ts"; export async function handleThreadListSync(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordThreadListSync; diff --git a/handlers/channels/THREAD_MEMBERS_UPDATE.ts b/plugins/bot/handlers/channels/THREAD_MEMBERS_UPDATE.ts similarity index 95% rename from handlers/channels/THREAD_MEMBERS_UPDATE.ts rename to plugins/bot/handlers/channels/THREAD_MEMBERS_UPDATE.ts index be40fe07d..12ca490a0 100644 --- a/handlers/channels/THREAD_MEMBERS_UPDATE.ts +++ b/plugins/bot/handlers/channels/THREAD_MEMBERS_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordThreadMembersUpdate } from "../../deps.ts"; export async function handleThreadMembersUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordThreadMembersUpdate; diff --git a/handlers/channels/THREAD_MEMBER_UPDATE.ts b/plugins/bot/handlers/channels/THREAD_MEMBER_UPDATE.ts similarity index 94% rename from handlers/channels/THREAD_MEMBER_UPDATE.ts rename to plugins/bot/handlers/channels/THREAD_MEMBER_UPDATE.ts index 404c7bc3f..b7718c8e1 100644 --- a/handlers/channels/THREAD_MEMBER_UPDATE.ts +++ b/plugins/bot/handlers/channels/THREAD_MEMBER_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordThreadMemberUpdate } from "../../deps.ts"; export async function handleThreadMemberUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordThreadMemberUpdate; diff --git a/handlers/channels/THREAD_UPDATE.ts b/plugins/bot/handlers/channels/THREAD_UPDATE.ts similarity index 75% rename from handlers/channels/THREAD_UPDATE.ts rename to plugins/bot/handlers/channels/THREAD_UPDATE.ts index ec839a350..5bc4d778a 100644 --- a/handlers/channels/THREAD_UPDATE.ts +++ b/plugins/bot/handlers/channels/THREAD_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordChannel, DiscordGatewayPayload } from "../../types/discord.ts"; +import { DiscordChannel, DiscordGatewayPayload } from "../../deps.ts"; export async function handleThreadUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordChannel; diff --git a/handlers/channels/mod.ts b/plugins/bot/handlers/channels/mod.ts similarity index 100% rename from handlers/channels/mod.ts rename to plugins/bot/handlers/channels/mod.ts diff --git a/handlers/emojis/GUILD_EMOJIS_UPDATE.ts b/plugins/bot/handlers/emojis/GUILD_EMOJIS_UPDATE.ts similarity index 77% rename from handlers/emojis/GUILD_EMOJIS_UPDATE.ts rename to plugins/bot/handlers/emojis/GUILD_EMOJIS_UPDATE.ts index ba7712750..dda4449d5 100644 --- a/handlers/emojis/GUILD_EMOJIS_UPDATE.ts +++ b/plugins/bot/handlers/emojis/GUILD_EMOJIS_UPDATE.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordGuildEmojisUpdate } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; export async function handleGuildEmojisUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildEmojisUpdate; diff --git a/handlers/emojis/mod.ts b/plugins/bot/handlers/emojis/mod.ts similarity index 100% rename from handlers/emojis/mod.ts rename to plugins/bot/handlers/emojis/mod.ts diff --git a/handlers/guilds/GUILD_BAN_ADD.ts b/plugins/bot/handlers/guilds/GUILD_BAN_ADD.ts similarity index 82% rename from handlers/guilds/GUILD_BAN_ADD.ts rename to plugins/bot/handlers/guilds/GUILD_BAN_ADD.ts index 889cd2133..64fc99002 100644 --- a/handlers/guilds/GUILD_BAN_ADD.ts +++ b/plugins/bot/handlers/guilds/GUILD_BAN_ADD.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../deps.ts"; export async function handleGuildBanAdd(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildBanAddRemove; diff --git a/handlers/guilds/GUILD_BAN_REMOVE.ts b/plugins/bot/handlers/guilds/GUILD_BAN_REMOVE.ts similarity index 83% rename from handlers/guilds/GUILD_BAN_REMOVE.ts rename to plugins/bot/handlers/guilds/GUILD_BAN_REMOVE.ts index 993df1c8b..6bc469dce 100644 --- a/handlers/guilds/GUILD_BAN_REMOVE.ts +++ b/plugins/bot/handlers/guilds/GUILD_BAN_REMOVE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordGuildBanAddRemove } from "../../deps.ts"; export async function handleGuildBanRemove(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildBanAddRemove; diff --git a/handlers/guilds/GUILD_CREATE.ts b/plugins/bot/handlers/guilds/GUILD_CREATE.ts similarity index 71% rename from handlers/guilds/GUILD_CREATE.ts rename to plugins/bot/handlers/guilds/GUILD_CREATE.ts index 95728e445..df7b5eedb 100644 --- a/handlers/guilds/GUILD_CREATE.ts +++ b/plugins/bot/handlers/guilds/GUILD_CREATE.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import type { Guild } from "../../transformers/guild.ts"; -import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts"; export function handleGuildCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordGuild; diff --git a/handlers/guilds/GUILD_DELETE.ts b/plugins/bot/handlers/guilds/GUILD_DELETE.ts similarity index 81% rename from handlers/guilds/GUILD_DELETE.ts rename to plugins/bot/handlers/guilds/GUILD_DELETE.ts index 80bddd0e0..8eb4d1346 100644 --- a/handlers/guilds/GUILD_DELETE.ts +++ b/plugins/bot/handlers/guilds/GUILD_DELETE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordUnavailableGuild } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordUnavailableGuild } from "../../deps.ts"; export async function handleGuildDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordUnavailableGuild; diff --git a/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts b/plugins/bot/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts similarity index 81% rename from handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts rename to plugins/bot/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts index ae05e67ca..6f15c917a 100644 --- a/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts +++ b/plugins/bot/handlers/guilds/GUILD_INTEGRATIONS_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGatewayPayload, DiscordGuildIntegrationsUpdate } from "../../deps.ts"; export async function handleGuildIntegrationsUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildIntegrationsUpdate; diff --git a/handlers/guilds/GUILD_LOADED_DD.ts b/plugins/bot/handlers/guilds/GUILD_LOADED_DD.ts similarity index 72% rename from handlers/guilds/GUILD_LOADED_DD.ts rename to plugins/bot/handlers/guilds/GUILD_LOADED_DD.ts index 2ccb44dfb..5672b7fef 100644 --- a/handlers/guilds/GUILD_LOADED_DD.ts +++ b/plugins/bot/handlers/guilds/GUILD_LOADED_DD.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import type { Guild } from "../../transformers/guild.ts"; -import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts"; export function handleGuildLoaded(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordGuild; diff --git a/handlers/guilds/GUILD_UPDATE.ts b/plugins/bot/handlers/guilds/GUILD_UPDATE.ts similarity index 71% rename from handlers/guilds/GUILD_UPDATE.ts rename to plugins/bot/handlers/guilds/GUILD_UPDATE.ts index d360ae7c7..a877d44f5 100644 --- a/handlers/guilds/GUILD_UPDATE.ts +++ b/plugins/bot/handlers/guilds/GUILD_UPDATE.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import type { Guild } from "../../transformers/guild.ts"; -import { DiscordGatewayPayload, DiscordGuild } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuild } from "../../deps.ts"; export function handleGuildUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordGuild; diff --git a/handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts similarity index 81% rename from handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts rename to plugins/bot/handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts index d44220ba4..3dad18258 100644 --- a/handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts +++ b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_ACTION_EXECUTION.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordAutoModerationActionExecution, DiscordGatewayPayload } from "../../../deps.ts"; /** Requires the MANAGE_GUILD permission. */ export function handleAutoModerationActionExecution(bot: Bot, data: DiscordGatewayPayload, shardId: number) { diff --git a/handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts similarity index 82% rename from handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts rename to plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts index a41d27b36..a8f8399c4 100644 --- a/handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts +++ b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_CREATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts"; /** Requires the MANAGE_GUILD permission. */ export function handleAutoModerationRuleCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) { diff --git a/handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts similarity index 82% rename from handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts rename to plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts index 28ec5f3c1..6bd4d7184 100644 --- a/handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts +++ b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_DELETE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts"; /** Requires the MANAGE_GUILD permission. */ export function handleAutoModerationRuleDelete(bot: Bot, data: DiscordGatewayPayload, shardId: number) { diff --git a/handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts similarity index 82% rename from handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts rename to plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts index 4e717fc5c..e5cefdab5 100644 --- a/handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts +++ b/plugins/bot/handlers/guilds/automod/AUTO_MODERATION_RULE_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordAutoModerationRule, DiscordGatewayPayload } from "../../../deps.ts"; /** Requires the MANAGE_GUILD permission. */ export function handleAutoModerationRuleUpdate(bot: Bot, data: DiscordGatewayPayload, shardId: number) { diff --git a/handlers/guilds/automod/mod.ts b/plugins/bot/handlers/guilds/automod/mod.ts similarity index 100% rename from handlers/guilds/automod/mod.ts rename to plugins/bot/handlers/guilds/automod/mod.ts diff --git a/handlers/guilds/mod.ts b/plugins/bot/handlers/guilds/mod.ts similarity index 100% rename from handlers/guilds/mod.ts rename to plugins/bot/handlers/guilds/mod.ts diff --git a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts similarity index 81% rename from handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts rename to plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts index 91841b958..901ed4ec3 100644 --- a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts +++ b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_CREATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts"; export function handleGuildScheduledEventCreate(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordScheduledEvent; diff --git a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts similarity index 80% rename from handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts rename to plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts index 704df9697..9fe06b70c 100644 --- a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts +++ b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_DELETE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts"; export function handleGuildScheduledEventDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordScheduledEvent; diff --git a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts similarity index 80% rename from handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts rename to plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts index a08f89f94..3a0c2792e 100644 --- a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts +++ b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_UPDATE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGatewayPayload, DiscordScheduledEvent } from "../../../deps.ts"; export function handleGuildScheduledEventUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordScheduledEvent; diff --git a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts similarity index 86% rename from handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts rename to plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts index 144fd672a..dec4e4092 100644 --- a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts +++ b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_ADD.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGatewayPayload, DiscordScheduledEventUserAdd } from "../../../deps.ts"; export function handleGuildScheduledEventUserAdd(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordScheduledEventUserAdd; diff --git a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts similarity index 85% rename from handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts rename to plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts index 7a53e9b26..f71314b02 100644 --- a/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts +++ b/plugins/bot/handlers/guilds/scheduledEvents/GUILD_SCHEDULED_EVENT_USER_REMOVE.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGatewayPayload, DiscordScheduledEventUserRemove } from "../../../deps.ts"; export function handleGuildScheduledEventUserRemove(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordScheduledEventUserRemove; diff --git a/handlers/guilds/scheduledEvents/mod.ts b/plugins/bot/handlers/guilds/scheduledEvents/mod.ts similarity index 100% rename from handlers/guilds/scheduledEvents/mod.ts rename to plugins/bot/handlers/guilds/scheduledEvents/mod.ts diff --git a/handlers/integrations/INTEGRATION_CREATE.ts b/plugins/bot/handlers/integrations/INTEGRATION_CREATE.ts similarity index 90% rename from handlers/integrations/INTEGRATION_CREATE.ts rename to plugins/bot/handlers/integrations/INTEGRATION_CREATE.ts index 87a10ab58..5f6147bd1 100644 --- a/handlers/integrations/INTEGRATION_CREATE.ts +++ b/plugins/bot/handlers/integrations/INTEGRATION_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../deps.ts"; export function handleIntegrationCreate(bot: Bot, data: DiscordGatewayPayload) { bot.events.integrationCreate( diff --git a/handlers/integrations/INTEGRATION_DELETE.ts b/plugins/bot/handlers/integrations/INTEGRATION_DELETE.ts similarity index 95% rename from handlers/integrations/INTEGRATION_DELETE.ts rename to plugins/bot/handlers/integrations/INTEGRATION_DELETE.ts index a9f19e1b1..da9abfcbb 100644 --- a/handlers/integrations/INTEGRATION_DELETE.ts +++ b/plugins/bot/handlers/integrations/INTEGRATION_DELETE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordIntegrationDelete } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordIntegrationDelete } from "../../deps.ts"; export function handleIntegrationDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordIntegrationDelete; diff --git a/handlers/integrations/INTEGRATION_UPDATE.ts b/plugins/bot/handlers/integrations/INTEGRATION_UPDATE.ts similarity index 90% rename from handlers/integrations/INTEGRATION_UPDATE.ts rename to plugins/bot/handlers/integrations/INTEGRATION_UPDATE.ts index 40cc920f3..103918dfe 100644 --- a/handlers/integrations/INTEGRATION_UPDATE.ts +++ b/plugins/bot/handlers/integrations/INTEGRATION_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordIntegrationCreateUpdate } from "../../deps.ts"; export function handleIntegrationUpdate(bot: Bot, data: DiscordGatewayPayload) { bot.events.integrationUpdate( diff --git a/handlers/integrations/mod.ts b/plugins/bot/handlers/integrations/mod.ts similarity index 100% rename from handlers/integrations/mod.ts rename to plugins/bot/handlers/integrations/mod.ts diff --git a/handlers/interactions/INTERACTION_CREATE.ts b/plugins/bot/handlers/interactions/INTERACTION_CREATE.ts similarity index 95% rename from handlers/interactions/INTERACTION_CREATE.ts rename to plugins/bot/handlers/interactions/INTERACTION_CREATE.ts index 9c9d4cfb2..634bb8a2a 100644 --- a/handlers/interactions/INTERACTION_CREATE.ts +++ b/plugins/bot/handlers/interactions/INTERACTION_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordInteraction } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordInteraction } from "../../deps.ts"; export async function handleInteractionCreate(bot: Bot, data: DiscordGatewayPayload) { bot.cache.unrepliedInteractions.add(bot.transformers.snowflake((data.d as DiscordInteraction).id)); diff --git a/handlers/interactions/mod.ts b/plugins/bot/handlers/interactions/mod.ts similarity index 100% rename from handlers/interactions/mod.ts rename to plugins/bot/handlers/interactions/mod.ts diff --git a/handlers/invites/INVITE_CREATE.ts b/plugins/bot/handlers/invites/INVITE_CREATE.ts similarity index 92% rename from handlers/invites/INVITE_CREATE.ts rename to plugins/bot/handlers/invites/INVITE_CREATE.ts index 624a694ec..e0e344fe4 100644 --- a/handlers/invites/INVITE_CREATE.ts +++ b/plugins/bot/handlers/invites/INVITE_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordInviteCreate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordInviteCreate } from "../../deps.ts"; export function handleInviteCreate(bot: Bot, data: DiscordGatewayPayload) { bot.events.inviteCreate(bot, bot.transformers.invite(bot, data.d as DiscordInviteCreate)); diff --git a/handlers/invites/INVITE_DELETE.ts b/plugins/bot/handlers/invites/INVITE_DELETE.ts similarity index 96% rename from handlers/invites/INVITE_DELETE.ts rename to plugins/bot/handlers/invites/INVITE_DELETE.ts index db4e54d44..c3b932b45 100644 --- a/handlers/invites/INVITE_DELETE.ts +++ b/plugins/bot/handlers/invites/INVITE_DELETE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordInviteDelete } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordInviteDelete } from "../../deps.ts"; export function handleInviteDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordInviteDelete; diff --git a/handlers/invites/mod.ts b/plugins/bot/handlers/invites/mod.ts similarity index 100% rename from handlers/invites/mod.ts rename to plugins/bot/handlers/invites/mod.ts diff --git a/handlers/members/GUILD_MEMBERS_CHUNK.ts b/plugins/bot/handlers/members/GUILD_MEMBERS_CHUNK.ts similarity index 98% rename from handlers/members/GUILD_MEMBERS_CHUNK.ts rename to plugins/bot/handlers/members/GUILD_MEMBERS_CHUNK.ts index 4e0fba27a..cb5352b10 100644 --- a/handlers/members/GUILD_MEMBERS_CHUNK.ts +++ b/plugins/bot/handlers/members/GUILD_MEMBERS_CHUNK.ts @@ -1,6 +1,6 @@ import { Bot } from "../../bot.ts"; import { statusTypes } from "../../transformers/presence.ts"; -import { DiscordGatewayPayload, DiscordGuildMembersChunk } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildMembersChunk } from "../../deps.ts"; export async function handleGuildMembersChunk(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildMembersChunk; diff --git a/handlers/members/GUILD_MEMBER_ADD.ts b/plugins/bot/handlers/members/GUILD_MEMBER_ADD.ts similarity index 95% rename from handlers/members/GUILD_MEMBER_ADD.ts rename to plugins/bot/handlers/members/GUILD_MEMBER_ADD.ts index 0c87836a0..81a76367a 100644 --- a/handlers/members/GUILD_MEMBER_ADD.ts +++ b/plugins/bot/handlers/members/GUILD_MEMBER_ADD.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildMemberAdd } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildMemberAdd } from "../../deps.ts"; export async function handleGuildMemberAdd(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildMemberAdd; diff --git a/handlers/members/GUILD_MEMBER_REMOVE.ts b/plugins/bot/handlers/members/GUILD_MEMBER_REMOVE.ts similarity index 94% rename from handlers/members/GUILD_MEMBER_REMOVE.ts rename to plugins/bot/handlers/members/GUILD_MEMBER_REMOVE.ts index 383a32be4..e733755a3 100644 --- a/handlers/members/GUILD_MEMBER_REMOVE.ts +++ b/plugins/bot/handlers/members/GUILD_MEMBER_REMOVE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildMemberRemove } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildMemberRemove } from "../../deps.ts"; export async function handleGuildMemberRemove(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildMemberRemove; diff --git a/handlers/members/GUILD_MEMBER_UPDATE.ts b/plugins/bot/handlers/members/GUILD_MEMBER_UPDATE.ts similarity index 94% rename from handlers/members/GUILD_MEMBER_UPDATE.ts rename to plugins/bot/handlers/members/GUILD_MEMBER_UPDATE.ts index ba413141b..2eecdc0b5 100644 --- a/handlers/members/GUILD_MEMBER_UPDATE.ts +++ b/plugins/bot/handlers/members/GUILD_MEMBER_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildMemberUpdate } from "../../deps.ts"; export async function handleGuildMemberUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildMemberUpdate; diff --git a/handlers/members/mod.ts b/plugins/bot/handlers/members/mod.ts similarity index 100% rename from handlers/members/mod.ts rename to plugins/bot/handlers/members/mod.ts diff --git a/handlers/messages/MESSAGE_CREATE.ts b/plugins/bot/handlers/messages/MESSAGE_CREATE.ts similarity index 75% rename from handlers/messages/MESSAGE_CREATE.ts rename to plugins/bot/handlers/messages/MESSAGE_CREATE.ts index 012bd4104..2ac08bca7 100644 --- a/handlers/messages/MESSAGE_CREATE.ts +++ b/plugins/bot/handlers/messages/MESSAGE_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessage } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessage } from "../../deps.ts"; export async function handleMessageCreate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessage; diff --git a/handlers/messages/MESSAGE_DELETE.ts b/plugins/bot/handlers/messages/MESSAGE_DELETE.ts similarity index 95% rename from handlers/messages/MESSAGE_DELETE.ts rename to plugins/bot/handlers/messages/MESSAGE_DELETE.ts index a20f6c5e2..60c8f8a6c 100644 --- a/handlers/messages/MESSAGE_DELETE.ts +++ b/plugins/bot/handlers/messages/MESSAGE_DELETE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageDelete } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageDelete } from "../../deps.ts"; export async function handleMessageDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageDelete; diff --git a/handlers/messages/MESSAGE_DELETE_BULK.ts b/plugins/bot/handlers/messages/MESSAGE_DELETE_BULK.ts similarity index 96% rename from handlers/messages/MESSAGE_DELETE_BULK.ts rename to plugins/bot/handlers/messages/MESSAGE_DELETE_BULK.ts index 6fd856e64..a63134e36 100644 --- a/handlers/messages/MESSAGE_DELETE_BULK.ts +++ b/plugins/bot/handlers/messages/MESSAGE_DELETE_BULK.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageDeleteBulk } from "../../deps.ts"; export async function handleMessageDeleteBulk(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageDeleteBulk; diff --git a/handlers/messages/MESSAGE_REACTION_ADD.ts b/plugins/bot/handlers/messages/MESSAGE_REACTION_ADD.ts similarity index 96% rename from handlers/messages/MESSAGE_REACTION_ADD.ts rename to plugins/bot/handlers/messages/MESSAGE_REACTION_ADD.ts index 9d14b2a1a..2949dd373 100644 --- a/handlers/messages/MESSAGE_REACTION_ADD.ts +++ b/plugins/bot/handlers/messages/MESSAGE_REACTION_ADD.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageReactionAdd } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageReactionAdd } from "../../deps.ts"; export async function handleMessageReactionAdd(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageReactionAdd; diff --git a/handlers/messages/MESSAGE_REACTION_REMOVE.ts b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE.ts similarity index 95% rename from handlers/messages/MESSAGE_REACTION_REMOVE.ts rename to plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE.ts index b33341863..d78b2027e 100644 --- a/handlers/messages/MESSAGE_REACTION_REMOVE.ts +++ b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageReactionRemove } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageReactionRemove } from "../../deps.ts"; export async function handleMessageReactionRemove(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageReactionRemove; diff --git a/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts similarity index 94% rename from handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts rename to plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts index f2a384925..2e85ad83e 100644 --- a/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts +++ b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_ALL.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageReactionRemoveAll } from "../../deps.ts"; export async function handleMessageReactionRemoveAll(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageReactionRemoveAll; diff --git a/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts similarity index 94% rename from handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts rename to plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts index 3f102a110..bbda9a1d7 100644 --- a/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts +++ b/plugins/bot/handlers/messages/MESSAGE_REACTION_REMOVE_EMOJI.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessageReactionRemoveEmoji } from "../../deps.ts"; export async function handleMessageReactionRemoveEmoji(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessageReactionRemoveEmoji; diff --git a/handlers/messages/MESSAGE_UPDATE.ts b/plugins/bot/handlers/messages/MESSAGE_UPDATE.ts similarity index 77% rename from handlers/messages/MESSAGE_UPDATE.ts rename to plugins/bot/handlers/messages/MESSAGE_UPDATE.ts index d26b8ed54..a3fb63a72 100644 --- a/handlers/messages/MESSAGE_UPDATE.ts +++ b/plugins/bot/handlers/messages/MESSAGE_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordMessage } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordMessage } from "../../deps.ts"; export async function handleMessageUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordMessage; diff --git a/handlers/messages/mod.ts b/plugins/bot/handlers/messages/mod.ts similarity index 100% rename from handlers/messages/mod.ts rename to plugins/bot/handlers/messages/mod.ts diff --git a/handlers/misc/PRESENCE_UPDATE.ts b/plugins/bot/handlers/misc/PRESENCE_UPDATE.ts similarity index 92% rename from handlers/misc/PRESENCE_UPDATE.ts rename to plugins/bot/handlers/misc/PRESENCE_UPDATE.ts index 2071f8da1..e6f56613b 100644 --- a/handlers/misc/PRESENCE_UPDATE.ts +++ b/plugins/bot/handlers/misc/PRESENCE_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordPresenceUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordPresenceUpdate } from "../../deps.ts"; export async function handlePresenceUpdate(bot: Bot, data: DiscordGatewayPayload) { bot.events.presenceUpdate(bot, bot.transformers.presence(bot, data.d as DiscordPresenceUpdate)); diff --git a/handlers/misc/READY.ts b/plugins/bot/handlers/misc/READY.ts similarity index 90% rename from handlers/misc/READY.ts rename to plugins/bot/handlers/misc/READY.ts index b438bff9d..176405af9 100644 --- a/handlers/misc/READY.ts +++ b/plugins/bot/handlers/misc/READY.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordReady } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordReady } from "../../deps.ts"; export function handleReady(bot: Bot, data: DiscordGatewayPayload, shardId: number) { const payload = data.d as DiscordReady; diff --git a/handlers/misc/TYPING_START.ts b/plugins/bot/handlers/misc/TYPING_START.ts similarity index 97% rename from handlers/misc/TYPING_START.ts rename to plugins/bot/handlers/misc/TYPING_START.ts index 6bb6e06fd..31107d16f 100644 --- a/handlers/misc/TYPING_START.ts +++ b/plugins/bot/handlers/misc/TYPING_START.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordTypingStart } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordTypingStart } from "../../deps.ts"; export function handleTypingStart(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordTypingStart; diff --git a/handlers/misc/USER_UPDATE.ts b/plugins/bot/handlers/misc/USER_UPDATE.ts similarity index 74% rename from handlers/misc/USER_UPDATE.ts rename to plugins/bot/handlers/misc/USER_UPDATE.ts index c02f2bdf8..aeaca15c2 100644 --- a/handlers/misc/USER_UPDATE.ts +++ b/plugins/bot/handlers/misc/USER_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordUser } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordUser } from "../../deps.ts"; export async function handleUserUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordUser; diff --git a/handlers/misc/mod.ts b/plugins/bot/handlers/misc/mod.ts similarity index 100% rename from handlers/misc/mod.ts rename to plugins/bot/handlers/misc/mod.ts diff --git a/handlers/mod.ts b/plugins/bot/handlers/mod.ts similarity index 100% rename from handlers/mod.ts rename to plugins/bot/handlers/mod.ts diff --git a/handlers/roles/GUILD_ROLE_CREATE.ts b/plugins/bot/handlers/roles/GUILD_ROLE_CREATE.ts similarity index 94% rename from handlers/roles/GUILD_ROLE_CREATE.ts rename to plugins/bot/handlers/roles/GUILD_ROLE_CREATE.ts index d1fc1e9d4..6a476d4a8 100644 --- a/handlers/roles/GUILD_ROLE_CREATE.ts +++ b/plugins/bot/handlers/roles/GUILD_ROLE_CREATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildRoleCreate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildRoleCreate } from "../../deps.ts"; export async function handleGuildRoleCreate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildRoleCreate; diff --git a/handlers/roles/GUILD_ROLE_DELETE.ts b/plugins/bot/handlers/roles/GUILD_ROLE_DELETE.ts similarity index 94% rename from handlers/roles/GUILD_ROLE_DELETE.ts rename to plugins/bot/handlers/roles/GUILD_ROLE_DELETE.ts index e0e13fa22..8b386933f 100644 --- a/handlers/roles/GUILD_ROLE_DELETE.ts +++ b/plugins/bot/handlers/roles/GUILD_ROLE_DELETE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildRoleDelete } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildRoleDelete } from "../../deps.ts"; export async function handleGuildRoleDelete(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildRoleDelete; diff --git a/handlers/roles/GUILD_ROLE_UPDATE.ts b/plugins/bot/handlers/roles/GUILD_ROLE_UPDATE.ts similarity index 94% rename from handlers/roles/GUILD_ROLE_UPDATE.ts rename to plugins/bot/handlers/roles/GUILD_ROLE_UPDATE.ts index 7d4ce211d..99610d906 100644 --- a/handlers/roles/GUILD_ROLE_UPDATE.ts +++ b/plugins/bot/handlers/roles/GUILD_ROLE_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordGuildRoleUpdate } from "../../deps.ts"; export async function handleGuildRoleUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordGuildRoleUpdate; diff --git a/handlers/roles/mod.ts b/plugins/bot/handlers/roles/mod.ts similarity index 100% rename from handlers/roles/mod.ts rename to plugins/bot/handlers/roles/mod.ts diff --git a/handlers/voice/VOICE_SERVER_UPDATE.ts b/plugins/bot/handlers/voice/VOICE_SERVER_UPDATE.ts similarity index 94% rename from handlers/voice/VOICE_SERVER_UPDATE.ts rename to plugins/bot/handlers/voice/VOICE_SERVER_UPDATE.ts index 73b5dd250..0f41ddb3b 100644 --- a/handlers/voice/VOICE_SERVER_UPDATE.ts +++ b/plugins/bot/handlers/voice/VOICE_SERVER_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordVoiceServerUpdate } from "../../deps.ts"; export async function handleVoiceServerUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordVoiceServerUpdate; diff --git a/handlers/voice/VOICE_STATE_UPDATE.ts b/plugins/bot/handlers/voice/VOICE_STATE_UPDATE.ts similarity index 95% rename from handlers/voice/VOICE_STATE_UPDATE.ts rename to plugins/bot/handlers/voice/VOICE_STATE_UPDATE.ts index 9c3767812..229a5598f 100644 --- a/handlers/voice/VOICE_STATE_UPDATE.ts +++ b/plugins/bot/handlers/voice/VOICE_STATE_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordVoiceState } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordVoiceState } from "../../deps.ts"; export async function handleVoiceStateUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordVoiceState; diff --git a/handlers/voice/mod.ts b/plugins/bot/handlers/voice/mod.ts similarity index 100% rename from handlers/voice/mod.ts rename to plugins/bot/handlers/voice/mod.ts diff --git a/handlers/webhooks/WEBHOOKS_UPDATE.ts b/plugins/bot/handlers/webhooks/WEBHOOKS_UPDATE.ts similarity index 94% rename from handlers/webhooks/WEBHOOKS_UPDATE.ts rename to plugins/bot/handlers/webhooks/WEBHOOKS_UPDATE.ts index 3271649e8..c262ae114 100644 --- a/handlers/webhooks/WEBHOOKS_UPDATE.ts +++ b/plugins/bot/handlers/webhooks/WEBHOOKS_UPDATE.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordGatewayPayload, DiscordWebhookUpdate } from "../../types/discord.ts"; +import { DiscordGatewayPayload, DiscordWebhookUpdate } from "../../deps.ts"; export function handleWebhooksUpdate(bot: Bot, data: DiscordGatewayPayload) { const payload = data.d as DiscordWebhookUpdate; diff --git a/handlers/webhooks/mod.ts b/plugins/bot/handlers/webhooks/mod.ts similarity index 100% rename from handlers/webhooks/mod.ts rename to plugins/bot/handlers/webhooks/mod.ts diff --git a/helpers/channels/createChannel.ts b/plugins/bot/helpers/channels/createChannel.ts similarity index 94% rename from helpers/channels/createChannel.ts rename to plugins/bot/helpers/channels/createChannel.ts index 7d9473fb9..0873dabe6 100644 --- a/helpers/channels/createChannel.ts +++ b/plugins/bot/helpers/channels/createChannel.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { ChannelTypes } from "../../types/shared.ts"; -import { DiscordChannel } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { ChannelTypes, DiscordChannel } from "../../deps.ts"; import { OverwriteReadable } from "./editChannelOverwrite.ts"; /** Create a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. */ diff --git a/helpers/channels/createStageInstance.ts b/plugins/bot/helpers/channels/createStageInstance.ts similarity index 88% rename from helpers/channels/createStageInstance.ts rename to plugins/bot/helpers/channels/createStageInstance.ts index 45a284461..49928379a 100644 --- a/helpers/channels/createStageInstance.ts +++ b/plugins/bot/helpers/channels/createStageInstance.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordStageInstance } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordStageInstance } from "../../deps.ts"; /** Creates a new Stage instance associated to a Stage channel. Requires the user to be a moderator of the Stage channel. */ export async function createStageInstance(bot: Bot, options: CreateStageInstance) { diff --git a/helpers/channels/deleteChannel.ts b/plugins/bot/helpers/channels/deleteChannel.ts similarity index 80% rename from helpers/channels/deleteChannel.ts rename to plugins/bot/helpers/channels/deleteChannel.ts index e10bf6acc..bc2bce24a 100644 --- a/helpers/channels/deleteChannel.ts +++ b/plugins/bot/helpers/channels/deleteChannel.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel } from "../../deps.ts"; /** Delete a channel in your server. Bot needs MANAGE_CHANNEL permissions in the server. Bot needs MANAGE_THREADS permissions in the server if deleting thread. */ export async function deleteChannel(bot: Bot, channelId: bigint, reason?: string) { diff --git a/helpers/channels/deleteChannelOverwrite.ts b/plugins/bot/helpers/channels/deleteChannelOverwrite.ts similarity index 89% rename from helpers/channels/deleteChannelOverwrite.ts rename to plugins/bot/helpers/channels/deleteChannelOverwrite.ts index 2d475b61f..cd0467a9f 100644 --- a/helpers/channels/deleteChannelOverwrite.ts +++ b/plugins/bot/helpers/channels/deleteChannelOverwrite.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */ export async function deleteChannelOverwrite(bot: Bot, channelId: bigint, overwriteId: bigint) { diff --git a/helpers/channels/deleteStageInstance.ts b/plugins/bot/helpers/channels/deleteStageInstance.ts similarity index 86% rename from helpers/channels/deleteStageInstance.ts rename to plugins/bot/helpers/channels/deleteStageInstance.ts index 8ba1e502a..a88fb041a 100644 --- a/helpers/channels/deleteStageInstance.ts +++ b/plugins/bot/helpers/channels/deleteStageInstance.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Deletes the Stage instance. Requires the user to be a moderator of the Stage channel. */ export async function deleteStageInstance(bot: Bot, channelId: bigint) { diff --git a/helpers/channels/editChannel.ts b/plugins/bot/helpers/channels/editChannel.ts similarity index 97% rename from helpers/channels/editChannel.ts rename to plugins/bot/helpers/channels/editChannel.ts index f70f780a6..fb4ea914f 100644 --- a/helpers/channels/editChannel.ts +++ b/plugins/bot/helpers/channels/editChannel.ts @@ -1,7 +1,6 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { Channel } from "../../transformers/channel.ts"; -import { DiscordChannel } from "../../types/discord.ts"; -import { ChannelTypes, VideoQualityModes } from "../../types/shared.ts"; +import { ChannelTypes, DiscordChannel, VideoQualityModes } from "../../deps.ts"; import { OverwriteReadable } from "./editChannelOverwrite.ts"; /** Update a channel's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */ diff --git a/helpers/channels/editChannelOverwrite.ts b/plugins/bot/helpers/channels/editChannelOverwrite.ts similarity index 90% rename from helpers/channels/editChannelOverwrite.ts rename to plugins/bot/helpers/channels/editChannelOverwrite.ts index c5cd60190..97385b265 100644 --- a/helpers/channels/editChannelOverwrite.ts +++ b/plugins/bot/helpers/channels/editChannelOverwrite.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { OverwriteTypes, PermissionStrings } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { OverwriteTypes, PermissionStrings } from "../../deps.ts"; /** Edit the channel permission overwrites for a user or role in this channel. Requires `MANAGE_ROLES` permission. */ export async function editChannelOverwrite( diff --git a/helpers/channels/followChannel.ts b/plugins/bot/helpers/channels/followChannel.ts similarity index 83% rename from helpers/channels/followChannel.ts rename to plugins/bot/helpers/channels/followChannel.ts index d469a89f7..5eb30a3be 100644 --- a/helpers/channels/followChannel.ts +++ b/plugins/bot/helpers/channels/followChannel.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordFollowedChannel } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordFollowedChannel } from "../../deps.ts"; /** Follow a News Channel to send messages to a target channel. Requires the `MANAGE_WEBHOOKS` permission in the target channel. Returns the webhook id. */ export async function followChannel(bot: Bot, sourceChannelId: bigint, targetChannelId: bigint) { diff --git a/helpers/channels/forums/createForumPost.ts b/plugins/bot/helpers/channels/forums/createForumPost.ts similarity index 92% rename from helpers/channels/forums/createForumPost.ts rename to plugins/bot/helpers/channels/forums/createForumPost.ts index 0bafd8110..948043741 100644 --- a/helpers/channels/forums/createForumPost.ts +++ b/plugins/bot/helpers/channels/forums/createForumPost.ts @@ -1,7 +1,7 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordChannel } from "../../../types/discord.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../../types/mod.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordChannel, FileContent } from "../../../deps.ts"; import { Embed } from "../../../transformers/embed.ts"; +import { AllowedMentions, MessageComponents } from "../../../typings.ts"; /** Creates a new public thread from an existing message. Returns a thread channel. */ export async function createForumPost( diff --git a/helpers/channels/forums/mod.ts b/plugins/bot/helpers/channels/forums/mod.ts similarity index 100% rename from helpers/channels/forums/mod.ts rename to plugins/bot/helpers/channels/forums/mod.ts diff --git a/helpers/channels/getChannel.ts b/plugins/bot/helpers/channels/getChannel.ts similarity index 83% rename from helpers/channels/getChannel.ts rename to plugins/bot/helpers/channels/getChannel.ts index 905f53f0f..d07619d21 100644 --- a/helpers/channels/getChannel.ts +++ b/plugins/bot/helpers/channels/getChannel.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel } from "../../deps.ts"; /** Fetches a single channel object from the api. */ export async function getChannel(bot: Bot, channelId: bigint) { diff --git a/helpers/channels/getChannelWebhooks.ts b/plugins/bot/helpers/channels/getChannelWebhooks.ts similarity index 73% rename from helpers/channels/getChannelWebhooks.ts rename to plugins/bot/helpers/channels/getChannelWebhooks.ts index 961c40f8a..85e98b5f7 100644 --- a/helpers/channels/getChannelWebhooks.ts +++ b/plugins/bot/helpers/channels/getChannelWebhooks.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; /** Gets the webhooks for this channel. Requires MANAGE_WEBHOOKS */ export async function getChannelWebhooks(bot: Bot, channelId: bigint) { diff --git a/helpers/channels/getChannels.ts b/plugins/bot/helpers/channels/getChannels.ts similarity index 71% rename from helpers/channels/getChannels.ts rename to plugins/bot/helpers/channels/getChannels.ts index c75419631..cffe8ce21 100644 --- a/helpers/channels/getChannels.ts +++ b/plugins/bot/helpers/channels/getChannels.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordChannel } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel } from "../../deps.ts"; /** Returns a list of guild channel objects. */ export async function getChannels(bot: Bot, guildId: bigint) { diff --git a/helpers/channels/getPins.ts b/plugins/bot/helpers/channels/getPins.ts similarity index 76% rename from helpers/channels/getPins.ts rename to plugins/bot/helpers/channels/getPins.ts index 3da7a30cb..7b07422ef 100644 --- a/helpers/channels/getPins.ts +++ b/plugins/bot/helpers/channels/getPins.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; /** Get pinned messages in this channel. */ export async function getPins(bot: Bot, channelId: bigint) { diff --git a/helpers/channels/getStageInstance.ts b/plugins/bot/helpers/channels/getStageInstance.ts similarity index 77% rename from helpers/channels/getStageInstance.ts rename to plugins/bot/helpers/channels/getStageInstance.ts index d2f6ae5af..e2d8b86b2 100644 --- a/helpers/channels/getStageInstance.ts +++ b/plugins/bot/helpers/channels/getStageInstance.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordStageInstance } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordStageInstance } from "../../deps.ts"; /** Gets the stage instance associated with the Stage channel, if it exists. */ export async function getStageInstance(bot: Bot, channelId: bigint) { diff --git a/helpers/channels/mod.ts b/plugins/bot/helpers/channels/mod.ts similarity index 100% rename from helpers/channels/mod.ts rename to plugins/bot/helpers/channels/mod.ts diff --git a/helpers/channels/startTyping.ts b/plugins/bot/helpers/channels/startTyping.ts similarity index 92% rename from helpers/channels/startTyping.ts rename to plugins/bot/helpers/channels/startTyping.ts index 75bc313e1..4cc968a3c 100644 --- a/helpers/channels/startTyping.ts +++ b/plugins/bot/helpers/channels/startTyping.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** * Trigger a typing indicator for the specified channel. Generally bots should **NOT** implement this route. diff --git a/helpers/channels/swapChannels.ts b/plugins/bot/helpers/channels/swapChannels.ts similarity index 96% rename from helpers/channels/swapChannels.ts rename to plugins/bot/helpers/channels/swapChannels.ts index a9feef7d8..f1c2a98c2 100644 --- a/helpers/channels/swapChannels.ts +++ b/plugins/bot/helpers/channels/swapChannels.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Modify the positions of channels on the guild. Requires MANAGE_CHANNELS permission. Only channels to be modified are required. */ export async function swapChannels(bot: Bot, guildId: bigint, channelPositions: ModifyGuildChannelPositions[]) { diff --git a/helpers/channels/threads/addToThread.ts b/plugins/bot/helpers/channels/threads/addToThread.ts similarity index 87% rename from helpers/channels/threads/addToThread.ts rename to plugins/bot/helpers/channels/threads/addToThread.ts index 068159fdd..7dba82850 100644 --- a/helpers/channels/threads/addToThread.ts +++ b/plugins/bot/helpers/channels/threads/addToThread.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** Adds a user to a thread. Requires the ability to send messages in the thread. Requires the thread is not archived. */ export async function addToThread(bot: Bot, threadId: bigint, userId: bigint) { diff --git a/helpers/channels/threads/getActiveThreads.ts b/plugins/bot/helpers/channels/threads/getActiveThreads.ts similarity index 80% rename from helpers/channels/threads/getActiveThreads.ts rename to plugins/bot/helpers/channels/threads/getActiveThreads.ts index aa4a9dd20..94621c298 100644 --- a/helpers/channels/threads/getActiveThreads.ts +++ b/plugins/bot/helpers/channels/threads/getActiveThreads.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordListActiveThreads } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordListActiveThreads } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Returns all active threads in the guild, including public and private threads. Threads are ordered by their `id`, in descending order. */ export async function getActiveThreads(bot: Bot, guildId: bigint) { diff --git a/helpers/channels/threads/getArchivedThreads.ts b/plugins/bot/helpers/channels/threads/getArchivedThreads.ts similarity index 88% rename from helpers/channels/threads/getArchivedThreads.ts rename to plugins/bot/helpers/channels/threads/getArchivedThreads.ts index 1c542a71b..d5f1285ae 100644 --- a/helpers/channels/threads/getArchivedThreads.ts +++ b/plugins/bot/helpers/channels/threads/getArchivedThreads.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../../util/collection.ts"; -import type { Bot } from "../../../bot.ts"; -import { DiscordListArchivedThreads } from "../../../types/discord.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordListArchivedThreads } from "../../../deps.ts"; /** Get the archived threads for this channel, defaults to public */ export async function getArchivedThreads( diff --git a/helpers/channels/threads/getThreadMember.ts b/plugins/bot/helpers/channels/threads/getThreadMember.ts similarity index 83% rename from helpers/channels/threads/getThreadMember.ts rename to plugins/bot/helpers/channels/threads/getThreadMember.ts index 091b8db9d..7feac1588 100644 --- a/helpers/channels/threads/getThreadMember.ts +++ b/plugins/bot/helpers/channels/threads/getThreadMember.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordThreadMember } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordThreadMember } from "../../../deps.ts"; /** Returns thread members objects that are members of the thread. */ export async function getThreadMember(bot: Bot, threadId: bigint, userId: bigint) { diff --git a/helpers/channels/threads/getThreadMembers.ts b/plugins/bot/helpers/channels/threads/getThreadMembers.ts similarity index 72% rename from helpers/channels/threads/getThreadMembers.ts rename to plugins/bot/helpers/channels/threads/getThreadMembers.ts index efd84fbb8..1950dcc63 100644 --- a/helpers/channels/threads/getThreadMembers.ts +++ b/plugins/bot/helpers/channels/threads/getThreadMembers.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordThreadMember } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordThreadMember } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Returns thread members objects that are members of the thread. */ export async function getThreadMembers(bot: Bot, threadId: bigint) { diff --git a/helpers/channels/threads/joinThread.ts b/plugins/bot/helpers/channels/threads/joinThread.ts similarity index 84% rename from helpers/channels/threads/joinThread.ts rename to plugins/bot/helpers/channels/threads/joinThread.ts index 785444196..9cfb89744 100644 --- a/helpers/channels/threads/joinThread.ts +++ b/plugins/bot/helpers/channels/threads/joinThread.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** Adds the bot to the thread. Cannot join an archived thread. */ export async function joinThread(bot: Bot, threadId: bigint) { diff --git a/helpers/channels/threads/leaveThread.ts b/plugins/bot/helpers/channels/threads/leaveThread.ts similarity index 84% rename from helpers/channels/threads/leaveThread.ts rename to plugins/bot/helpers/channels/threads/leaveThread.ts index f4ed15f6a..a2ff845bb 100644 --- a/helpers/channels/threads/leaveThread.ts +++ b/plugins/bot/helpers/channels/threads/leaveThread.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** Removes the bot from a thread. Requires the thread is not archived. */ export async function leaveThread(bot: Bot, threadId: bigint) { diff --git a/helpers/channels/threads/mod.ts b/plugins/bot/helpers/channels/threads/mod.ts similarity index 100% rename from helpers/channels/threads/mod.ts rename to plugins/bot/helpers/channels/threads/mod.ts diff --git a/helpers/channels/threads/removeThreadMember.ts b/plugins/bot/helpers/channels/threads/removeThreadMember.ts similarity index 89% rename from helpers/channels/threads/removeThreadMember.ts rename to plugins/bot/helpers/channels/threads/removeThreadMember.ts index 7359a9cb9..c7a608530 100644 --- a/helpers/channels/threads/removeThreadMember.ts +++ b/plugins/bot/helpers/channels/threads/removeThreadMember.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** Removes a user from a thread. Requires the MANAGE_THREADS permission or that you are the creator of the thread. Also requires the thread is not archived. */ export async function removeThreadMember(bot: Bot, threadId: bigint, userId: bigint) { diff --git a/helpers/channels/threads/startThreadWithMessage.ts b/plugins/bot/helpers/channels/threads/startThreadWithMessage.ts similarity index 90% rename from helpers/channels/threads/startThreadWithMessage.ts rename to plugins/bot/helpers/channels/threads/startThreadWithMessage.ts index 7dcaf52e2..9d464fc98 100644 --- a/helpers/channels/threads/startThreadWithMessage.ts +++ b/plugins/bot/helpers/channels/threads/startThreadWithMessage.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordChannel } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordChannel } from "../../../deps.ts"; /** Creates a new public thread from an existing message. Returns a thread channel. */ export async function startThreadWithMessage( diff --git a/helpers/channels/threads/startThreadWithoutMessage.ts b/plugins/bot/helpers/channels/threads/startThreadWithoutMessage.ts similarity index 88% rename from helpers/channels/threads/startThreadWithoutMessage.ts rename to plugins/bot/helpers/channels/threads/startThreadWithoutMessage.ts index 4b54a6888..3bf45cd6c 100644 --- a/helpers/channels/threads/startThreadWithoutMessage.ts +++ b/plugins/bot/helpers/channels/threads/startThreadWithoutMessage.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordChannel } from "../../../types/discord.ts"; -import { ChannelTypes } from "../../../types/shared.ts"; +import { Bot } from "../../../bot.ts"; +import { ChannelTypes, DiscordChannel } from "../../../deps.ts"; /** Creates a new private thread. Returns a thread channel. */ export async function startThreadWithoutMessage(bot: Bot, channelId: bigint, options: StartThreadWithoutMessage) { diff --git a/helpers/channels/updateStageInstance.ts b/plugins/bot/helpers/channels/updateStageInstance.ts similarity index 75% rename from helpers/channels/updateStageInstance.ts rename to plugins/bot/helpers/channels/updateStageInstance.ts index e283ef192..0723c4818 100644 --- a/helpers/channels/updateStageInstance.ts +++ b/plugins/bot/helpers/channels/updateStageInstance.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordStageInstance } from "../../types/discord.ts"; -import { AtLeastOne } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { AtLeastOne, DiscordStageInstance } from "../../deps.ts"; /** Updates fields of an existing Stage instance. Requires the user to be a moderator of the Stage channel. */ export async function updateStageInstance( diff --git a/helpers/channels/updateVoiceState.ts b/plugins/bot/helpers/channels/updateVoiceState.ts similarity index 98% rename from helpers/channels/updateVoiceState.ts rename to plugins/bot/helpers/channels/updateVoiceState.ts index 01f952473..1252d53fb 100644 --- a/helpers/channels/updateVoiceState.ts +++ b/plugins/bot/helpers/channels/updateVoiceState.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** * Updates the bot's voice state diff --git a/helpers/discovery/addDiscoverySubcategory.ts b/plugins/bot/helpers/discovery/addDiscoverySubcategory.ts similarity index 74% rename from helpers/discovery/addDiscoverySubcategory.ts rename to plugins/bot/helpers/discovery/addDiscoverySubcategory.ts index 858ac2cab..65d734002 100644 --- a/helpers/discovery/addDiscoverySubcategory.ts +++ b/plugins/bot/helpers/discovery/addDiscoverySubcategory.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordAddGuildDiscoverySubcategory } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordAddGuildDiscoverySubcategory } from "../../deps.ts"; /** Add a discovery subcategory to the guild. Requires the `MANAGE_GUILD` permission. */ export async function addDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { diff --git a/helpers/discovery/editDiscovery.ts b/plugins/bot/helpers/discovery/editDiscovery.ts similarity index 93% rename from helpers/discovery/editDiscovery.ts rename to plugins/bot/helpers/discovery/editDiscovery.ts index 65d679546..828bfbcc3 100644 --- a/helpers/discovery/editDiscovery.ts +++ b/plugins/bot/helpers/discovery/editDiscovery.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordDiscoveryMetadata } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordDiscoveryMetadata } from "../../deps.ts"; /** Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success. */ export async function editDiscovery(bot: Bot, guildId: bigint, data: ModifyGuildDiscoveryMetadata) { diff --git a/helpers/discovery/getDiscovery.ts b/plugins/bot/helpers/discovery/getDiscovery.ts similarity index 88% rename from helpers/discovery/getDiscovery.ts rename to plugins/bot/helpers/discovery/getDiscovery.ts index 38d2c8fa1..091452f65 100644 --- a/helpers/discovery/getDiscovery.ts +++ b/plugins/bot/helpers/discovery/getDiscovery.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordDiscoveryMetadata } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordDiscoveryMetadata } from "../../deps.ts"; /** Returns the discovery metadata object for the guild. Requires the `MANAGE_GUILD` permission. */ export async function getDiscovery(bot: Bot, guildId: bigint) { diff --git a/helpers/discovery/getDiscoveryCategories.ts b/plugins/bot/helpers/discovery/getDiscoveryCategories.ts similarity index 74% rename from helpers/discovery/getDiscoveryCategories.ts rename to plugins/bot/helpers/discovery/getDiscoveryCategories.ts index 8bc2ac5e3..dbffb323a 100644 --- a/helpers/discovery/getDiscoveryCategories.ts +++ b/plugins/bot/helpers/discovery/getDiscoveryCategories.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordDiscoveryCategory } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordDiscoveryCategory } from "../../deps.ts"; /** Returns a Collection (mapped by Id of the discovery category object) of discovery category objects that can be used when editing guilds */ export async function getDiscoveryCategories(bot: Bot) { diff --git a/helpers/discovery/mod.ts b/plugins/bot/helpers/discovery/mod.ts similarity index 100% rename from helpers/discovery/mod.ts rename to plugins/bot/helpers/discovery/mod.ts diff --git a/helpers/discovery/removeDiscoverySubcategory.ts b/plugins/bot/helpers/discovery/removeDiscoverySubcategory.ts similarity index 90% rename from helpers/discovery/removeDiscoverySubcategory.ts rename to plugins/bot/helpers/discovery/removeDiscoverySubcategory.ts index 6837ed79e..2b2db0cdd 100644 --- a/helpers/discovery/removeDiscoverySubcategory.ts +++ b/plugins/bot/helpers/discovery/removeDiscoverySubcategory.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Removes a discovery subcategory from the guild. Requires the MANAGE_GUILD permission. Returns a 204 No Content on success. */ export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) { diff --git a/helpers/discovery/validDiscoveryTerm.ts b/plugins/bot/helpers/discovery/validDiscoveryTerm.ts similarity index 68% rename from helpers/discovery/validDiscoveryTerm.ts rename to plugins/bot/helpers/discovery/validDiscoveryTerm.ts index f34833809..24b783bc4 100644 --- a/helpers/discovery/validDiscoveryTerm.ts +++ b/plugins/bot/helpers/discovery/validDiscoveryTerm.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordValidateDiscoverySearchTerm } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordValidateDiscoverySearchTerm } from "../../deps.ts"; export async function validDiscoveryTerm(bot: Bot, term: string) { const result = await bot.rest.runMethod( diff --git a/helpers/emojis/createEmoji.ts b/plugins/bot/helpers/emojis/createEmoji.ts similarity index 92% rename from helpers/emojis/createEmoji.ts rename to plugins/bot/helpers/emojis/createEmoji.ts index a94d56d5f..b5ea32af8 100644 --- a/helpers/emojis/createEmoji.ts +++ b/plugins/bot/helpers/emojis/createEmoji.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordEmoji } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordEmoji } from "../../deps.ts"; /** Create an emoji in the server */ export async function createEmoji(bot: Bot, guildId: bigint, options: CreateGuildEmoji) { diff --git a/helpers/emojis/deleteEmoji.ts b/plugins/bot/helpers/emojis/deleteEmoji.ts similarity index 88% rename from helpers/emojis/deleteEmoji.ts rename to plugins/bot/helpers/emojis/deleteEmoji.ts index c03982adc..67e9f23de 100644 --- a/helpers/emojis/deleteEmoji.ts +++ b/plugins/bot/helpers/emojis/deleteEmoji.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success. */ export async function deleteEmoji(bot: Bot, guildId: bigint, id: bigint, reason?: string) { diff --git a/helpers/emojis/editEmoji.ts b/plugins/bot/helpers/emojis/editEmoji.ts similarity index 88% rename from helpers/emojis/editEmoji.ts rename to plugins/bot/helpers/emojis/editEmoji.ts index 6bee65478..599036b8a 100644 --- a/helpers/emojis/editEmoji.ts +++ b/plugins/bot/helpers/emojis/editEmoji.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordEmoji } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordEmoji } from "../../deps.ts"; /** Modify the given emoji. Requires the MANAGE_EMOJIS permission. */ export async function editEmoji(bot: Bot, guildId: bigint, id: bigint, options: ModifyGuildEmoji) { diff --git a/helpers/emojis/emojiUrl.ts b/plugins/bot/helpers/emojis/emojiUrl.ts similarity index 100% rename from helpers/emojis/emojiUrl.ts rename to plugins/bot/helpers/emojis/emojiUrl.ts diff --git a/helpers/emojis/getEmoji.ts b/plugins/bot/helpers/emojis/getEmoji.ts similarity index 77% rename from helpers/emojis/getEmoji.ts rename to plugins/bot/helpers/emojis/getEmoji.ts index f96c1cecc..b005e1bb5 100644 --- a/helpers/emojis/getEmoji.ts +++ b/plugins/bot/helpers/emojis/getEmoji.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordEmoji } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordEmoji } from "../../deps.ts"; /** * Returns an emoji for the given guild and emoji Id. diff --git a/helpers/emojis/getEmojis.ts b/plugins/bot/helpers/emojis/getEmojis.ts similarity index 70% rename from helpers/emojis/getEmojis.ts rename to plugins/bot/helpers/emojis/getEmojis.ts index c51529cc1..2caa39529 100644 --- a/helpers/emojis/getEmojis.ts +++ b/plugins/bot/helpers/emojis/getEmojis.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordEmoji } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordEmoji } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; /** * Returns a list of emojis for the given guild. diff --git a/helpers/emojis/mod.ts b/plugins/bot/helpers/emojis/mod.ts similarity index 100% rename from helpers/emojis/mod.ts rename to plugins/bot/helpers/emojis/mod.ts diff --git a/helpers/guilds/automod/createAutomodRule.ts b/plugins/bot/helpers/guilds/automod/createAutomodRule.ts similarity index 98% rename from helpers/guilds/automod/createAutomodRule.ts rename to plugins/bot/helpers/guilds/automod/createAutomodRule.ts index bc6b3d06d..72bf9d3ea 100644 --- a/helpers/guilds/automod/createAutomodRule.ts +++ b/plugins/bot/helpers/guilds/automod/createAutomodRule.ts @@ -5,7 +5,7 @@ import { AutoModerationTriggerTypes, DiscordAutoModerationRule, DiscordAutoModerationRuleTriggerMetadataPresets, -} from "../../../types/discord.ts"; +} from "../../../deps.ts"; /** Get a rule currently configured for guild. */ export async function createAutomodRule(bot: Bot, guildId: bigint, options: CreateAutoModerationRuleOptions) { diff --git a/helpers/guilds/automod/deleteAutomodRule.ts b/plugins/bot/helpers/guilds/automod/deleteAutomodRule.ts similarity index 100% rename from helpers/guilds/automod/deleteAutomodRule.ts rename to plugins/bot/helpers/guilds/automod/deleteAutomodRule.ts diff --git a/helpers/guilds/automod/editAutomodRule.ts b/plugins/bot/helpers/guilds/automod/editAutomodRule.ts similarity index 98% rename from helpers/guilds/automod/editAutomodRule.ts rename to plugins/bot/helpers/guilds/automod/editAutomodRule.ts index 04b522498..d962f41d6 100644 --- a/helpers/guilds/automod/editAutomodRule.ts +++ b/plugins/bot/helpers/guilds/automod/editAutomodRule.ts @@ -4,7 +4,7 @@ import { AutoModerationEventTypes, DiscordAutoModerationRule, DiscordAutoModerationRuleTriggerMetadataPresets, -} from "../../../types/discord.ts"; +} from "../../../deps.ts"; /** Edit a rule currently configured for guild. */ export async function editAutomodRule(bot: Bot, guildId: bigint, options: Partial) { diff --git a/helpers/guilds/automod/getAutomodRule.ts b/plugins/bot/helpers/guilds/automod/getAutomodRule.ts similarity index 73% rename from helpers/guilds/automod/getAutomodRule.ts rename to plugins/bot/helpers/guilds/automod/getAutomodRule.ts index 51aecf9a6..d10a40a87 100644 --- a/helpers/guilds/automod/getAutomodRule.ts +++ b/plugins/bot/helpers/guilds/automod/getAutomodRule.ts @@ -1,6 +1,6 @@ import { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationRule } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { DiscordAutoModerationRule } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Get a rule currently configured for guild. */ export async function getAutomodRule(bot: Bot, guildId: bigint, ruleId: bigint) { diff --git a/helpers/guilds/automod/getAutomodRules.ts b/plugins/bot/helpers/guilds/automod/getAutomodRules.ts similarity index 76% rename from helpers/guilds/automod/getAutomodRules.ts rename to plugins/bot/helpers/guilds/automod/getAutomodRules.ts index 882d504e3..a6605e2d8 100644 --- a/helpers/guilds/automod/getAutomodRules.ts +++ b/plugins/bot/helpers/guilds/automod/getAutomodRules.ts @@ -1,6 +1,6 @@ import { Bot } from "../../../bot.ts"; -import { DiscordAutoModerationRule } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { DiscordAutoModerationRule } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Get a list of all rules currently configured for guild. */ export async function getAutomodRules(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/automod/mod.ts b/plugins/bot/helpers/guilds/automod/mod.ts similarity index 100% rename from helpers/guilds/automod/mod.ts rename to plugins/bot/helpers/guilds/automod/mod.ts diff --git a/helpers/guilds/createGuild.ts b/plugins/bot/helpers/guilds/createGuild.ts similarity index 94% rename from helpers/guilds/createGuild.ts rename to plugins/bot/helpers/guilds/createGuild.ts index 39084574c..f169786dc 100644 --- a/helpers/guilds/createGuild.ts +++ b/plugins/bot/helpers/guilds/createGuild.ts @@ -1,13 +1,13 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { Channel } from "../../transformers/channel.ts"; import { Role } from "../../transformers/role.ts"; -import { DiscordGuild } from "../../types/discord.ts"; import { DefaultMessageNotificationLevels, + DiscordGuild, ExplicitContentFilterLevels, SystemChannelFlags, VerificationLevels, -} from "../../types/shared.ts"; +} from "../../deps.ts"; /** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */ export async function createGuild(bot: Bot, options: CreateGuild) { diff --git a/helpers/guilds/deleteGuild.ts b/plugins/bot/helpers/guilds/deleteGuild.ts similarity index 87% rename from helpers/guilds/deleteGuild.ts rename to plugins/bot/helpers/guilds/deleteGuild.ts index 98b083815..e49a4026d 100644 --- a/helpers/guilds/deleteGuild.ts +++ b/plugins/bot/helpers/guilds/deleteGuild.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete a guild permanently. User must be owner. Returns 204 No Content on success. Fires a Guild Delete Gateway event. */ export async function deleteGuild(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/editGuild.ts b/plugins/bot/helpers/guilds/editGuild.ts similarity index 96% rename from helpers/guilds/editGuild.ts rename to plugins/bot/helpers/guilds/editGuild.ts index 8017b6c0e..45207871d 100644 --- a/helpers/guilds/editGuild.ts +++ b/plugins/bot/helpers/guilds/editGuild.ts @@ -1,12 +1,12 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuild } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; import { DefaultMessageNotificationLevels, + DiscordGuild, ExplicitContentFilterLevels, GuildFeatures, SystemChannelFlags, VerificationLevels, -} from "../../types/shared.ts"; +} from "../../deps.ts"; /** Modify a guilds settings. Requires the MANAGE_GUILD permission. */ export async function editGuild(bot: Bot, guildId: bigint, options: ModifyGuild, shardId: number) { diff --git a/helpers/guilds/editWelcomeScreen.ts b/plugins/bot/helpers/guilds/editWelcomeScreen.ts similarity index 93% rename from helpers/guilds/editWelcomeScreen.ts rename to plugins/bot/helpers/guilds/editWelcomeScreen.ts index aabb30645..735af6887 100644 --- a/helpers/guilds/editWelcomeScreen.ts +++ b/plugins/bot/helpers/guilds/editWelcomeScreen.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWelcomeScreen } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWelcomeScreen } from "../../deps.ts"; export async function editWelcomeScreen(bot: Bot, guildId: bigint, options: ModifyGuildWelcomeScreen) { const result = await bot.rest.runMethod( diff --git a/helpers/guilds/editWidget.ts b/plugins/bot/helpers/guilds/editWidget.ts similarity index 80% rename from helpers/guilds/editWidget.ts rename to plugins/bot/helpers/guilds/editWidget.ts index dea1df89b..91ba54eb7 100644 --- a/helpers/guilds/editWidget.ts +++ b/plugins/bot/helpers/guilds/editWidget.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuildWidgetSettings } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuildWidgetSettings } from "../../deps.ts"; /** Modify a guild widget object for the guild. Requires the MANAGE_GUILD permission. */ export async function editWidget(bot: Bot, guildId: bigint, enabled: boolean, channelId?: string | null) { diff --git a/helpers/guilds/getAuditLogs.ts b/plugins/bot/helpers/guilds/getAuditLogs.ts similarity index 94% rename from helpers/guilds/getAuditLogs.ts rename to plugins/bot/helpers/guilds/getAuditLogs.ts index 157b69271..d7ae954c4 100644 --- a/helpers/guilds/getAuditLogs.ts +++ b/plugins/bot/helpers/guilds/getAuditLogs.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordAuditLog } from "../../types/discord.ts"; -import { AuditLogEvents } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { AuditLogEvents, DiscordAuditLog } from "../../deps.ts"; /** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */ export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuildAuditLog) { diff --git a/helpers/guilds/getAvailableVoiceRegions.ts b/plugins/bot/helpers/guilds/getAvailableVoiceRegions.ts similarity index 74% rename from helpers/guilds/getAvailableVoiceRegions.ts rename to plugins/bot/helpers/guilds/getAvailableVoiceRegions.ts index 91a6a1cf2..a52f6e01b 100644 --- a/helpers/guilds/getAvailableVoiceRegions.ts +++ b/plugins/bot/helpers/guilds/getAvailableVoiceRegions.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordVoiceRegion } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordVoiceRegion } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; /** Returns an array of voice regions that can be used when creating servers. */ export async function getAvailableVoiceRegions(bot: Bot) { diff --git a/helpers/guilds/getBan.ts b/plugins/bot/helpers/guilds/getBan.ts similarity index 83% rename from helpers/guilds/getBan.ts rename to plugins/bot/helpers/guilds/getBan.ts index 0a53886a8..89b6f811b 100644 --- a/helpers/guilds/getBan.ts +++ b/plugins/bot/helpers/guilds/getBan.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordBan } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordBan } from "../../deps.ts"; /** Returns a ban object for the given user or a 404 not found if the ban cannot be found. Requires the BAN_MEMBERS permission. */ export async function getBan(bot: Bot, guildId: bigint, memberId: bigint) { diff --git a/helpers/guilds/getBans.ts b/plugins/bot/helpers/guilds/getBans.ts similarity index 85% rename from helpers/guilds/getBans.ts rename to plugins/bot/helpers/guilds/getBans.ts index 9c3268e8f..af87b43a8 100644 --- a/helpers/guilds/getBans.ts +++ b/plugins/bot/helpers/guilds/getBans.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { Collection } from "../../util/collection.ts"; -import { DiscordBan } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { DiscordBan } from "../../deps.ts"; import { User } from "../../transformers/member.ts"; /** Returns a list of ban objects for the users banned from this guild. Requires the BAN_MEMBERS permission. */ diff --git a/helpers/guilds/getGuild.ts b/plugins/bot/helpers/guilds/getGuild.ts similarity index 87% rename from helpers/guilds/getGuild.ts rename to plugins/bot/helpers/guilds/getGuild.ts index 3f4ca137e..6cd906d7a 100644 --- a/helpers/guilds/getGuild.ts +++ b/plugins/bot/helpers/guilds/getGuild.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuild } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuild } from "../../deps.ts"; /** * This function fetches a guild's data. This is not the same data as a GUILD_CREATE. diff --git a/helpers/guilds/getGuildPreview.ts b/plugins/bot/helpers/guilds/getGuildPreview.ts similarity index 90% rename from helpers/guilds/getGuildPreview.ts rename to plugins/bot/helpers/guilds/getGuildPreview.ts index 3d84abce9..54e4c2844 100644 --- a/helpers/guilds/getGuildPreview.ts +++ b/plugins/bot/helpers/guilds/getGuildPreview.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuildPreview } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuildPreview } from "../../deps.ts"; /** Returns the guild preview object for the given id. If the bot is not in the guild, then the guild must be Discoverable. */ export async function getGuildPreview(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/getPruneCount.ts b/plugins/bot/helpers/guilds/getPruneCount.ts similarity index 95% rename from helpers/guilds/getPruneCount.ts rename to plugins/bot/helpers/guilds/getPruneCount.ts index e22901124..1f9ee3097 100644 --- a/helpers/guilds/getPruneCount.ts +++ b/plugins/bot/helpers/guilds/getPruneCount.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Check how many members would be removed from the server in a prune operation. Requires the KICK_MEMBERS permission */ export async function getPruneCount(bot: Bot, guildId: bigint, options?: GetGuildPruneCountQuery) { diff --git a/helpers/guilds/getVanityUrl.ts b/plugins/bot/helpers/guilds/getVanityUrl.ts similarity index 80% rename from helpers/guilds/getVanityUrl.ts rename to plugins/bot/helpers/guilds/getVanityUrl.ts index faeb02bed..66cccf012 100644 --- a/helpers/guilds/getVanityUrl.ts +++ b/plugins/bot/helpers/guilds/getVanityUrl.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordInviteMetadata } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInviteMetadata } from "../../deps.ts"; /** Returns the code and uses of the vanity url for this server if it is enabled else `code` will be null. Requires the `MANAGE_GUILD` permission. */ export async function getVanityUrl(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/getVoiceRegions.ts b/plugins/bot/helpers/guilds/getVoiceRegions.ts similarity index 76% rename from helpers/guilds/getVoiceRegions.ts rename to plugins/bot/helpers/guilds/getVoiceRegions.ts index 490cb91af..b889e97a7 100644 --- a/helpers/guilds/getVoiceRegions.ts +++ b/plugins/bot/helpers/guilds/getVoiceRegions.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordVoiceRegion } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordVoiceRegion } from "../../deps.ts"; /** Returns a list of voice region objects for the guild. Unlike the similar /voice route, this returns VIP servers when the guild is VIP-enabled. */ export async function getVoiceRegions(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/getWelcomeScreen.ts b/plugins/bot/helpers/guilds/getWelcomeScreen.ts similarity index 78% rename from helpers/guilds/getWelcomeScreen.ts rename to plugins/bot/helpers/guilds/getWelcomeScreen.ts index d6c7aecd7..e7a984b89 100644 --- a/helpers/guilds/getWelcomeScreen.ts +++ b/plugins/bot/helpers/guilds/getWelcomeScreen.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWelcomeScreen } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWelcomeScreen } from "../../deps.ts"; /** Returns the Welcome Screen object for the guild. Requires the `MANAGE_GUILD` permission. */ export async function getWelcomeScreen(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/getWidget.ts b/plugins/bot/helpers/guilds/getWidget.ts similarity index 74% rename from helpers/guilds/getWidget.ts rename to plugins/bot/helpers/guilds/getWidget.ts index e96bc7fad..611852ee0 100644 --- a/helpers/guilds/getWidget.ts +++ b/plugins/bot/helpers/guilds/getWidget.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuildWidget } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuildWidget } from "../../deps.ts"; /** Returns the widget for the guild. */ export async function getWidget(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/getWidgetImageUrl.ts b/plugins/bot/helpers/guilds/getWidgetImageUrl.ts similarity index 96% rename from helpers/guilds/getWidgetImageUrl.ts rename to plugins/bot/helpers/guilds/getWidgetImageUrl.ts index 75dd6e385..64c4b0d56 100644 --- a/helpers/guilds/getWidgetImageUrl.ts +++ b/plugins/bot/helpers/guilds/getWidgetImageUrl.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Returns the widget image URL for the guild. */ export async function getWidgetImageURL(bot: Bot, guildId: bigint, options?: GetGuildWidgetImageQuery) { diff --git a/helpers/guilds/getWidgetSettings.ts b/plugins/bot/helpers/guilds/getWidgetSettings.ts similarity index 76% rename from helpers/guilds/getWidgetSettings.ts rename to plugins/bot/helpers/guilds/getWidgetSettings.ts index caacdadb2..93b868293 100644 --- a/helpers/guilds/getWidgetSettings.ts +++ b/plugins/bot/helpers/guilds/getWidgetSettings.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuildWidgetSettings } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuildWidgetSettings } from "../../deps.ts"; /** Returns a guild widget settings object. Requires the MANAGE_GUILD permission. */ export async function getWidgetSettings(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/guildBannerUrl.ts b/plugins/bot/helpers/guilds/guildBannerUrl.ts similarity index 93% rename from helpers/guilds/guildBannerUrl.ts rename to plugins/bot/helpers/guilds/guildBannerUrl.ts index b00340dd3..1d9418f2d 100644 --- a/helpers/guilds/guildBannerUrl.ts +++ b/plugins/bot/helpers/guilds/guildBannerUrl.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { ImageFormat, ImageSize } from "../members/avatarUrl.ts"; /** The full URL of the banner from Discords CDN. Undefined if no banner is set. */ diff --git a/helpers/guilds/guildIconUrl.ts b/plugins/bot/helpers/guilds/guildIconUrl.ts similarity index 93% rename from helpers/guilds/guildIconUrl.ts rename to plugins/bot/helpers/guilds/guildIconUrl.ts index 16d7686ad..5f97329b4 100644 --- a/helpers/guilds/guildIconUrl.ts +++ b/plugins/bot/helpers/guilds/guildIconUrl.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { ImageFormat, ImageSize } from "../members/avatarUrl.ts"; /** The full URL of the icon from Discords CDN. Undefined when no icon is set. */ diff --git a/helpers/guilds/guildSplashUrl.ts b/plugins/bot/helpers/guilds/guildSplashUrl.ts similarity index 93% rename from helpers/guilds/guildSplashUrl.ts rename to plugins/bot/helpers/guilds/guildSplashUrl.ts index aaa9114be..82f6e01d4 100644 --- a/helpers/guilds/guildSplashUrl.ts +++ b/plugins/bot/helpers/guilds/guildSplashUrl.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { ImageFormat, ImageSize } from "../members/avatarUrl.ts"; /** The full URL of the splash from Discords CDN. Undefined if no splash is set. */ diff --git a/helpers/guilds/leaveGuild.ts b/plugins/bot/helpers/guilds/leaveGuild.ts similarity index 82% rename from helpers/guilds/leaveGuild.ts rename to plugins/bot/helpers/guilds/leaveGuild.ts index 1d998af1b..008117420 100644 --- a/helpers/guilds/leaveGuild.ts +++ b/plugins/bot/helpers/guilds/leaveGuild.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Leave a guild */ export async function leaveGuild(bot: Bot, guildId: bigint) { diff --git a/helpers/guilds/mod.ts b/plugins/bot/helpers/guilds/mod.ts similarity index 100% rename from helpers/guilds/mod.ts rename to plugins/bot/helpers/guilds/mod.ts diff --git a/helpers/guilds/scheduledEvents/createScheduledEvent.ts b/plugins/bot/helpers/guilds/scheduledEvents/createScheduledEvent.ts similarity index 94% rename from helpers/guilds/scheduledEvents/createScheduledEvent.ts rename to plugins/bot/helpers/guilds/scheduledEvents/createScheduledEvent.ts index 2407f6a0c..73b42dcc5 100644 --- a/helpers/guilds/scheduledEvents/createScheduledEvent.ts +++ b/plugins/bot/helpers/guilds/scheduledEvents/createScheduledEvent.ts @@ -1,6 +1,5 @@ import { Bot } from "../../../bot.ts"; -import { DiscordScheduledEvent } from "../../../types/discord.ts"; -import { ScheduledEventEntityType, ScheduledEventPrivacyLevel } from "../../../types/shared.ts"; +import { DiscordScheduledEvent, ScheduledEventEntityType, ScheduledEventPrivacyLevel } from "../../../deps.ts"; /** Create a guild scheduled event in the guild. A guild can have a maximum of 100 events with `SCHEDULED` or `ACTIVE` status at any time. */ export async function createScheduledEvent(bot: Bot, guildId: bigint, options: CreateScheduledEvent) { diff --git a/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts b/plugins/bot/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts similarity index 100% rename from helpers/guilds/scheduledEvents/deleteScheduledEvent.ts rename to plugins/bot/helpers/guilds/scheduledEvents/deleteScheduledEvent.ts diff --git a/helpers/guilds/scheduledEvents/editScheduledEvent.ts b/plugins/bot/helpers/guilds/scheduledEvents/editScheduledEvent.ts similarity index 93% rename from helpers/guilds/scheduledEvents/editScheduledEvent.ts rename to plugins/bot/helpers/guilds/scheduledEvents/editScheduledEvent.ts index 405d6034c..19e36b08d 100644 --- a/helpers/guilds/scheduledEvents/editScheduledEvent.ts +++ b/plugins/bot/helpers/guilds/scheduledEvents/editScheduledEvent.ts @@ -1,6 +1,10 @@ import { Bot } from "../../../bot.ts"; -import { DiscordScheduledEvent } from "../../../types/discord.ts"; -import { ScheduledEventEntityType, ScheduledEventPrivacyLevel, ScheduledEventStatus } from "../../../types/shared.ts"; +import { + DiscordScheduledEvent, + ScheduledEventEntityType, + ScheduledEventPrivacyLevel, + ScheduledEventStatus, +} from "../../../deps.ts"; /** Modify a guild scheduled event. To start or end an event, use this endpoint to modify the event's status. */ export async function editScheduledEvent( diff --git a/helpers/guilds/scheduledEvents/getScheduledEvent.ts b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvent.ts similarity index 87% rename from helpers/guilds/scheduledEvents/getScheduledEvent.ts rename to plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvent.ts index ba43b6b89..c01fbd331 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEvent.ts +++ b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvent.ts @@ -1,5 +1,5 @@ import { Bot } from "../../../bot.ts"; -import { DiscordScheduledEvent } from "../../../types/discord.ts"; +import { DiscordScheduledEvent } from "../../../deps.ts"; /** Get a guild scheduled event. */ export async function getScheduledEvent( diff --git a/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts similarity index 94% rename from helpers/guilds/scheduledEvents/getScheduledEventUsers.ts rename to plugins/bot/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts index 6fdb1c202..32f287d64 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts +++ b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEventUsers.ts @@ -1,7 +1,7 @@ import { Bot } from "../../../bot.ts"; import { Member, User } from "../../../transformers/member.ts"; -import { DiscordMember, DiscordUser } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { DiscordMember, DiscordUser } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; export async function getScheduledEventUsers( bot: Bot, diff --git a/helpers/guilds/scheduledEvents/getScheduledEvents.ts b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvents.ts similarity index 85% rename from helpers/guilds/scheduledEvents/getScheduledEvents.ts rename to plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvents.ts index 69d35bc47..f02c63cd6 100644 --- a/helpers/guilds/scheduledEvents/getScheduledEvents.ts +++ b/plugins/bot/helpers/guilds/scheduledEvents/getScheduledEvents.ts @@ -1,7 +1,7 @@ import { Bot } from "../../../bot.ts"; import { ScheduledEvent } from "../../../transformers/scheduledEvent.ts"; -import { DiscordScheduledEvent } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { DiscordScheduledEvent } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Get a list of guild scheduled event for the given guild. */ export async function getScheduledEvents(bot: Bot, guildId: bigint, options?: GetScheduledEvents) { diff --git a/helpers/guilds/scheduledEvents/mod.ts b/plugins/bot/helpers/guilds/scheduledEvents/mod.ts similarity index 100% rename from helpers/guilds/scheduledEvents/mod.ts rename to plugins/bot/helpers/guilds/scheduledEvents/mod.ts diff --git a/helpers/integrations/deleteIntegration.ts b/plugins/bot/helpers/integrations/deleteIntegration.ts similarity index 88% rename from helpers/integrations/deleteIntegration.ts rename to plugins/bot/helpers/integrations/deleteIntegration.ts index 19d0cb431..07647114a 100644 --- a/helpers/integrations/deleteIntegration.ts +++ b/plugins/bot/helpers/integrations/deleteIntegration.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete the attached integration object for the guild with this id. Requires MANAGE_GUILD permission. */ export async function deleteIntegration(bot: Bot, guildId: bigint, id: bigint) { diff --git a/helpers/integrations/getIntegrations.ts b/plugins/bot/helpers/integrations/getIntegrations.ts similarity index 86% rename from helpers/integrations/getIntegrations.ts rename to plugins/bot/helpers/integrations/getIntegrations.ts index b244a347a..e20e126f9 100644 --- a/helpers/integrations/getIntegrations.ts +++ b/plugins/bot/helpers/integrations/getIntegrations.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { Collection } from "../../util/collection.ts"; -import { DiscordIntegration } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { DiscordIntegration } from "../../deps.ts"; /** Returns a list of integrations for the guild. Requires the MANAGE_GUILD permission. */ export async function getIntegrations(bot: Bot, guildId: bigint) { diff --git a/helpers/integrations/mod.ts b/plugins/bot/helpers/integrations/mod.ts similarity index 100% rename from helpers/integrations/mod.ts rename to plugins/bot/helpers/integrations/mod.ts diff --git a/helpers/interactions/commands/createApplicationCommand.ts b/plugins/bot/helpers/interactions/commands/createApplicationCommand.ts similarity index 93% rename from helpers/interactions/commands/createApplicationCommand.ts rename to plugins/bot/helpers/interactions/commands/createApplicationCommand.ts index e8109238e..81610c048 100644 --- a/helpers/interactions/commands/createApplicationCommand.ts +++ b/plugins/bot/helpers/interactions/commands/createApplicationCommand.ts @@ -1,7 +1,13 @@ -import type { Bot } from "../../../bot.ts"; -import { ApplicationCommandOption, ApplicationCommandTypes, Localization } from "../../../mod.ts"; -import { DiscordApplicationCommand, DiscordApplicationCommandOption } from "../../../types/discord.ts"; -import { AtLeastOne, PermissionStrings } from "../../../types/shared.ts"; +import { Bot } from "../../../bot.ts"; +import { + ApplicationCommandTypes, + AtLeastOne, + DiscordApplicationCommand, + DiscordApplicationCommandOption, + Localization, + PermissionStrings, +} from "../../../deps.ts"; +import { ApplicationCommandOption } from "../../../transformers/applicationCommandOption.ts"; /** * There are two kinds of Application Commands: global commands and guild commands. Global commands are available for every guild that adds your app; guild commands are specific to the guild you specify when making them. Command names are unique per application within each scope (global and guild). That means: diff --git a/helpers/interactions/commands/deleteApplicationCommand.ts b/plugins/bot/helpers/interactions/commands/deleteApplicationCommand.ts similarity index 89% rename from helpers/interactions/commands/deleteApplicationCommand.ts rename to plugins/bot/helpers/interactions/commands/deleteApplicationCommand.ts index ea4fe49c4..d40e3714c 100644 --- a/helpers/interactions/commands/deleteApplicationCommand.ts +++ b/plugins/bot/helpers/interactions/commands/deleteApplicationCommand.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** Deletes a application command. */ export async function deleteApplicationCommand(bot: Bot, id: bigint, guildId?: bigint) { diff --git a/helpers/interactions/commands/deleteInteractionResponse.ts b/plugins/bot/helpers/interactions/commands/deleteInteractionResponse.ts similarity index 92% rename from helpers/interactions/commands/deleteInteractionResponse.ts rename to plugins/bot/helpers/interactions/commands/deleteInteractionResponse.ts index 7bdcb5808..6b60a78f9 100644 --- a/helpers/interactions/commands/deleteInteractionResponse.ts +++ b/plugins/bot/helpers/interactions/commands/deleteInteractionResponse.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; /** To delete your response to a application command. If a message id is not provided, it will default to deleting the original response. */ export async function deleteInteractionResponse(bot: Bot, token: string, messageId?: bigint) { diff --git a/helpers/interactions/commands/editApplicationCommandPermissions.ts b/plugins/bot/helpers/interactions/commands/editApplicationCommandPermissions.ts similarity index 84% rename from helpers/interactions/commands/editApplicationCommandPermissions.ts rename to plugins/bot/helpers/interactions/commands/editApplicationCommandPermissions.ts index 598327e78..d74b2a6ab 100644 --- a/helpers/interactions/commands/editApplicationCommandPermissions.ts +++ b/plugins/bot/helpers/interactions/commands/editApplicationCommandPermissions.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGuildApplicationCommandPermissions } from "../../../types/discord.ts"; -import { ApplicationCommandPermissionTypes } from "../../../types/shared.ts"; +import { Bot } from "../../../bot.ts"; +import { ApplicationCommandPermissionTypes, DiscordGuildApplicationCommandPermissions } from "../../../deps.ts"; /** Edits command permissions for a specific command for your application in a guild. */ export async function editApplicationCommandPermissions( diff --git a/helpers/interactions/commands/editInteractionResponse.ts b/plugins/bot/helpers/interactions/commands/editInteractionResponse.ts similarity index 97% rename from helpers/interactions/commands/editInteractionResponse.ts rename to plugins/bot/helpers/interactions/commands/editInteractionResponse.ts index 8a287cef2..f634c3c71 100644 --- a/helpers/interactions/commands/editInteractionResponse.ts +++ b/plugins/bot/helpers/interactions/commands/editInteractionResponse.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { MessageComponentTypes } from "../../../types/shared.ts"; +import { Bot } from "../../../bot.ts"; +import { MessageComponentTypes } from "../../../deps.ts"; import { EditWebhookMessage } from "../../webhooks/editWebhookMessage.ts"; /** To edit your response to a application command. If a messageId is not provided it will default to editing the original response. */ diff --git a/helpers/interactions/commands/getApplicationCommand.ts b/plugins/bot/helpers/interactions/commands/getApplicationCommand.ts similarity index 91% rename from helpers/interactions/commands/getApplicationCommand.ts rename to plugins/bot/helpers/interactions/commands/getApplicationCommand.ts index 8f4f4d10c..103c0c674 100644 --- a/helpers/interactions/commands/getApplicationCommand.ts +++ b/plugins/bot/helpers/interactions/commands/getApplicationCommand.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordApplicationCommand } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordApplicationCommand } from "../../../deps.ts"; /** Fetches the global command for the given Id. If a guildId is provided, the guild command will be fetched. */ export async function getApplicationCommand(bot: Bot, commandId: bigint, options?: GetApplicationCommand) { diff --git a/helpers/interactions/commands/getApplicationCommandPermission.ts b/plugins/bot/helpers/interactions/commands/getApplicationCommandPermission.ts similarity index 89% rename from helpers/interactions/commands/getApplicationCommandPermission.ts rename to plugins/bot/helpers/interactions/commands/getApplicationCommandPermission.ts index db51ecb53..62fdd7771 100644 --- a/helpers/interactions/commands/getApplicationCommandPermission.ts +++ b/plugins/bot/helpers/interactions/commands/getApplicationCommandPermission.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGuildApplicationCommandPermissions } from "../../../types/discord.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGuildApplicationCommandPermissions } from "../../../deps.ts"; /** Fetches command permissions for a specific command for your application in a guild. Returns a GuildApplicationCommandPermissions object. */ export async function getApplicationCommandPermission(bot: Bot, guildId: bigint, commandId: bigint) { diff --git a/helpers/interactions/commands/getApplicationCommandPermissions.ts b/plugins/bot/helpers/interactions/commands/getApplicationCommandPermissions.ts similarity index 83% rename from helpers/interactions/commands/getApplicationCommandPermissions.ts rename to plugins/bot/helpers/interactions/commands/getApplicationCommandPermissions.ts index b3e1d81af..a412729b7 100644 --- a/helpers/interactions/commands/getApplicationCommandPermissions.ts +++ b/plugins/bot/helpers/interactions/commands/getApplicationCommandPermissions.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../../bot.ts"; -import { DiscordGuildApplicationCommandPermissions } from "../../../types/discord.ts"; -import { Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordGuildApplicationCommandPermissions } from "../../../deps.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; /** Fetches command permissions for all commands for your application in a guild. Returns an array of GuildApplicationCommandPermissions objects. */ export async function getApplicationCommandPermissions(bot: Bot, guildId: bigint) { diff --git a/helpers/interactions/commands/getApplicationCommands.ts b/plugins/bot/helpers/interactions/commands/getApplicationCommands.ts similarity index 77% rename from helpers/interactions/commands/getApplicationCommands.ts rename to plugins/bot/helpers/interactions/commands/getApplicationCommands.ts index 65022d09b..8f65af105 100644 --- a/helpers/interactions/commands/getApplicationCommands.ts +++ b/plugins/bot/helpers/interactions/commands/getApplicationCommands.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../../util/collection.ts"; -import type { Bot } from "../../../bot.ts"; -import { DiscordApplicationCommand } from "../../../types/discord.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { DiscordApplicationCommand } from "../../../deps.ts"; /** Fetch all the commands for your application. If a guild id is not provided, it will fetch global commands. */ export async function getApplicationCommands(bot: Bot, guildId?: bigint) { diff --git a/helpers/interactions/commands/mod.ts b/plugins/bot/helpers/interactions/commands/mod.ts similarity index 100% rename from helpers/interactions/commands/mod.ts rename to plugins/bot/helpers/interactions/commands/mod.ts diff --git a/helpers/interactions/commands/upsertApplicationCommand.ts b/plugins/bot/helpers/interactions/commands/upsertApplicationCommand.ts similarity index 86% rename from helpers/interactions/commands/upsertApplicationCommand.ts rename to plugins/bot/helpers/interactions/commands/upsertApplicationCommand.ts index c04f6cad5..6b2680967 100644 --- a/helpers/interactions/commands/upsertApplicationCommand.ts +++ b/plugins/bot/helpers/interactions/commands/upsertApplicationCommand.ts @@ -1,12 +1,11 @@ -import type { Bot } from "../../../bot.ts"; +import { Bot } from "../../../bot.ts"; import { CreateApplicationCommand, CreateContextApplicationCommand, isContextApplicationCommand, makeOptionsForCommand, } from "./createApplicationCommand.ts"; -import { DiscordApplicationCommand } from "../../../types/discord.ts"; -import { AtLeastOne } from "../../../types/shared.ts"; +import { AtLeastOne, DiscordApplicationCommand } from "../../../deps.ts"; /** * Edit an existing application command. If this command did not exist, it will create it. diff --git a/helpers/interactions/commands/upsertApplicationCommands.ts b/plugins/bot/helpers/interactions/commands/upsertApplicationCommands.ts similarity index 86% rename from helpers/interactions/commands/upsertApplicationCommands.ts rename to plugins/bot/helpers/interactions/commands/upsertApplicationCommands.ts index c8976b991..7a2e3fedd 100644 --- a/helpers/interactions/commands/upsertApplicationCommands.ts +++ b/plugins/bot/helpers/interactions/commands/upsertApplicationCommands.ts @@ -1,13 +1,12 @@ -import type { Bot } from "../../../bot.ts"; -import { Collection } from "../../../util/collection.ts"; +import { Bot } from "../../../bot.ts"; +import { BotCollection as Collection } from "../../../util/collection.ts"; import { CreateApplicationCommand, CreateContextApplicationCommand, isContextApplicationCommand, makeOptionsForCommand, } from "./createApplicationCommand.ts"; -import { DiscordApplicationCommand } from "../../../types/discord.ts"; -import { MakeRequired } from "../../../types/shared.ts"; +import { DiscordApplicationCommand, MakeRequired } from "../../../deps.ts"; /** * Bulk edit existing application commands. If a command does not exist, it will create it. diff --git a/helpers/interactions/followups/deleteFollowupMessage.ts b/plugins/bot/helpers/interactions/followups/deleteFollowupMessage.ts similarity index 100% rename from helpers/interactions/followups/deleteFollowupMessage.ts rename to plugins/bot/helpers/interactions/followups/deleteFollowupMessage.ts diff --git a/helpers/interactions/followups/editFollowupMessage.ts b/plugins/bot/helpers/interactions/followups/editFollowupMessage.ts similarity index 96% rename from helpers/interactions/followups/editFollowupMessage.ts rename to plugins/bot/helpers/interactions/followups/editFollowupMessage.ts index ce1361808..ce2abe4c4 100644 --- a/helpers/interactions/followups/editFollowupMessage.ts +++ b/plugins/bot/helpers/interactions/followups/editFollowupMessage.ts @@ -1,6 +1,5 @@ import { Bot } from "../../../bot.ts"; -import { DiscordMessage } from "../../../types/discord.ts"; -import { MessageComponentTypes } from "../../../types/shared.ts"; +import { DiscordMessage, MessageComponentTypes } from "../../../deps.ts"; import { EditWebhookMessage } from "../../webhooks/editWebhookMessage.ts"; /** Edits a followup message for an Interaction. Functions the same as edit webhook message, however this uses your interaction token instead of bot token. Does not support ephemeral followups. */ diff --git a/helpers/interactions/followups/getFollowupMessage.ts b/plugins/bot/helpers/interactions/followups/getFollowupMessage.ts similarity index 90% rename from helpers/interactions/followups/getFollowupMessage.ts rename to plugins/bot/helpers/interactions/followups/getFollowupMessage.ts index 0cc79d125..2e741cf9d 100644 --- a/helpers/interactions/followups/getFollowupMessage.ts +++ b/plugins/bot/helpers/interactions/followups/getFollowupMessage.ts @@ -1,5 +1,5 @@ import { Bot } from "../../../bot.ts"; -import { DiscordMessage } from "../../../types/discord.ts"; +import { DiscordMessage } from "../../../deps.ts"; /** Returns a followup message for an Interaction. Functions the same as get webhook message, however this uses your interaction token instead of bot token. Does not support ephemeral followups. */ export async function getFollowupMessage(bot: Bot, interactionToken: string, messageId: bigint) { diff --git a/helpers/interactions/followups/mod.ts b/plugins/bot/helpers/interactions/followups/mod.ts similarity index 100% rename from helpers/interactions/followups/mod.ts rename to plugins/bot/helpers/interactions/followups/mod.ts diff --git a/helpers/interactions/getOriginalInteractionResponse.ts b/plugins/bot/helpers/interactions/getOriginalInteractionResponse.ts similarity index 80% rename from helpers/interactions/getOriginalInteractionResponse.ts rename to plugins/bot/helpers/interactions/getOriginalInteractionResponse.ts index e6f5ca1e2..2f9196825 100644 --- a/helpers/interactions/getOriginalInteractionResponse.ts +++ b/plugins/bot/helpers/interactions/getOriginalInteractionResponse.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; /** Returns the initial Interaction response. Functions the same as Get Webhook Message */ export async function getOriginalInteractionResponse(bot: Bot, token: string) { diff --git a/helpers/interactions/mod.ts b/plugins/bot/helpers/interactions/mod.ts similarity index 100% rename from helpers/interactions/mod.ts rename to plugins/bot/helpers/interactions/mod.ts diff --git a/helpers/interactions/sendInteractionResponse.ts b/plugins/bot/helpers/interactions/sendInteractionResponse.ts similarity index 92% rename from helpers/interactions/sendInteractionResponse.ts rename to plugins/bot/helpers/interactions/sendInteractionResponse.ts index 8ae1665c3..6ad70f3c9 100644 --- a/helpers/interactions/sendInteractionResponse.ts +++ b/plugins/bot/helpers/interactions/sendInteractionResponse.ts @@ -1,8 +1,7 @@ -import type { Bot } from "../../bot.ts"; -import { Embed } from "../../mod.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../types/discordeno.ts"; -import { InteractionResponseTypes, MessageComponentTypes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage, FileContent, InteractionResponseTypes } from "../../deps.ts"; +import { Embed } from "../../transformers/embed.ts"; +import { AllowedMentions, MessageComponents } from "../../typings.ts"; /** * Send a response to a users application command. The command data will have the id and token necessary to respond. diff --git a/helpers/interactions/verifySignature.ts b/plugins/bot/helpers/interactions/verifySignature.ts similarity index 100% rename from helpers/interactions/verifySignature.ts rename to plugins/bot/helpers/interactions/verifySignature.ts diff --git a/helpers/invites/createInvite.ts b/plugins/bot/helpers/invites/createInvite.ts similarity index 93% rename from helpers/invites/createInvite.ts rename to plugins/bot/helpers/invites/createInvite.ts index 498baa216..494f90660 100644 --- a/helpers/invites/createInvite.ts +++ b/plugins/bot/helpers/invites/createInvite.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordInvite } from "../../types/discord.ts"; -import { InviteTargetTypes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInvite, InviteTargetTypes } from "../../deps.ts"; /** Creates a new invite for this channel. Requires CREATE_INSTANT_INVITE */ export async function createInvite(bot: Bot, channelId: bigint, options: CreateChannelInvite = {}) { diff --git a/helpers/invites/deleteInvite.ts b/plugins/bot/helpers/invites/deleteInvite.ts similarity index 72% rename from helpers/invites/deleteInvite.ts rename to plugins/bot/helpers/invites/deleteInvite.ts index 21f7ee839..f0a2f1b95 100644 --- a/helpers/invites/deleteInvite.ts +++ b/plugins/bot/helpers/invites/deleteInvite.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordInviteMetadata } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInviteMetadata } from "../../deps.ts"; /** Deletes an invite for the given code. Requires `MANAGE_CHANNELS` or `MANAGE_GUILD` permission */ export async function deleteInvite(bot: Bot, inviteCode: string) { diff --git a/helpers/invites/getChannelInvites.ts b/plugins/bot/helpers/invites/getChannelInvites.ts similarity index 77% rename from helpers/invites/getChannelInvites.ts rename to plugins/bot/helpers/invites/getChannelInvites.ts index becc88e58..5e57f51e4 100644 --- a/helpers/invites/getChannelInvites.ts +++ b/plugins/bot/helpers/invites/getChannelInvites.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordInviteMetadata } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInviteMetadata } from "../../deps.ts"; /** Gets the invites for this channel. Requires MANAGE_CHANNEL */ export async function getChannelInvites(bot: Bot, channelId: bigint) { diff --git a/helpers/invites/getInvite.ts b/plugins/bot/helpers/invites/getInvite.ts similarity index 93% rename from helpers/invites/getInvite.ts rename to plugins/bot/helpers/invites/getInvite.ts index 034eee463..7d6fdb0af 100644 --- a/helpers/invites/getInvite.ts +++ b/plugins/bot/helpers/invites/getInvite.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordInviteMetadata } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInviteMetadata } from "../../deps.ts"; /** Returns an invite for the given code or throws an error if the invite doesn't exists. */ export async function getInvite(bot: Bot, inviteCode: string, options?: GetInvite) { diff --git a/helpers/invites/getInvites.ts b/plugins/bot/helpers/invites/getInvites.ts similarity index 77% rename from helpers/invites/getInvites.ts rename to plugins/bot/helpers/invites/getInvites.ts index d7509a7a5..d188fa79b 100644 --- a/helpers/invites/getInvites.ts +++ b/plugins/bot/helpers/invites/getInvites.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordInviteMetadata } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordInviteMetadata } from "../../deps.ts"; /** Get all the invites for this guild. Requires MANAGE_GUILD permission */ export async function getInvites(bot: Bot, guildId: bigint) { diff --git a/helpers/invites/mod.ts b/plugins/bot/helpers/invites/mod.ts similarity index 100% rename from helpers/invites/mod.ts rename to plugins/bot/helpers/invites/mod.ts diff --git a/helpers/members/avatarUrl.ts b/plugins/bot/helpers/members/avatarUrl.ts similarity index 95% rename from helpers/members/avatarUrl.ts rename to plugins/bot/helpers/members/avatarUrl.ts index fcdc89b47..684d9c636 100644 --- a/helpers/members/avatarUrl.ts +++ b/plugins/bot/helpers/members/avatarUrl.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** The users custom avatar or the default avatar if you don't have a member object. */ export function avatarURL( diff --git a/helpers/members/banMember.ts b/plugins/bot/helpers/members/banMember.ts similarity index 94% rename from helpers/members/banMember.ts rename to plugins/bot/helpers/members/banMember.ts index 168d4769b..6be6b790a 100644 --- a/helpers/members/banMember.ts +++ b/plugins/bot/helpers/members/banMember.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Ban a user from the guild and optionally delete previous messages sent by the user. Requires the BAN_MEMBERS permission. */ export async function banMember(bot: Bot, guildId: bigint, id: bigint, options?: CreateGuildBan) { diff --git a/helpers/members/editBotNickname.ts b/plugins/bot/helpers/members/editBotNickname.ts similarity index 90% rename from helpers/members/editBotNickname.ts rename to plugins/bot/helpers/members/editBotNickname.ts index 57fd5a562..a1c7f1801 100644 --- a/helpers/members/editBotNickname.ts +++ b/plugins/bot/helpers/members/editBotNickname.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Edit the nickname of the bot in this guild */ export async function editBotNickname(bot: Bot, guildId: bigint, options: { nick: string | null; reason?: string }) { diff --git a/helpers/members/editMember.ts b/plugins/bot/helpers/members/editMember.ts similarity index 94% rename from helpers/members/editMember.ts rename to plugins/bot/helpers/members/editMember.ts index 83eb254ec..2c2a3cd3f 100644 --- a/helpers/members/editMember.ts +++ b/plugins/bot/helpers/members/editMember.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMemberWithUser } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMemberWithUser } from "../../deps.ts"; /** Edit the member */ export async function editMember(bot: Bot, guildId: bigint, memberId: bigint, options: ModifyGuildMember) { diff --git a/helpers/members/fetchMembers.ts b/plugins/bot/helpers/members/fetchMembers.ts similarity index 95% rename from helpers/members/fetchMembers.ts rename to plugins/bot/helpers/members/fetchMembers.ts index ee7dc3a5b..aa28500f4 100644 --- a/helpers/members/fetchMembers.ts +++ b/plugins/bot/helpers/members/fetchMembers.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { GatewayIntents, GatewayOpcodes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { GatewayIntents, GatewayOpcodes } from "../../deps.ts"; /** * Highly recommended to use this function to fetch members instead of getMember from REST. diff --git a/helpers/members/getDmChannel.ts b/plugins/bot/helpers/members/getDmChannel.ts similarity index 83% rename from helpers/members/getDmChannel.ts rename to plugins/bot/helpers/members/getDmChannel.ts index fdc228aeb..18842c6d9 100644 --- a/helpers/members/getDmChannel.ts +++ b/plugins/bot/helpers/members/getDmChannel.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordChannel } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordChannel } from "../../deps.ts"; /** Get a user's dm channel. This is required in order to send a DM. */ export async function getDmChannel(bot: Bot, userId: bigint) { diff --git a/helpers/members/getMember.ts b/plugins/bot/helpers/members/getMember.ts similarity index 78% rename from helpers/members/getMember.ts rename to plugins/bot/helpers/members/getMember.ts index 3263e3e88..bde694b4c 100644 --- a/helpers/members/getMember.ts +++ b/plugins/bot/helpers/members/getMember.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMemberWithUser } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMemberWithUser } from "../../deps.ts"; /** Returns a guild member object for the specified user. */ export async function getMember(bot: Bot, guildId: bigint, id: bigint) { diff --git a/helpers/members/getMembers.ts b/plugins/bot/helpers/members/getMembers.ts similarity index 86% rename from helpers/members/getMembers.ts rename to plugins/bot/helpers/members/getMembers.ts index f35923448..02b486331 100644 --- a/helpers/members/getMembers.ts +++ b/plugins/bot/helpers/members/getMembers.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMemberWithUser } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMemberWithUser } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; // TODO: make options optional /** diff --git a/helpers/members/kickMember.ts b/plugins/bot/helpers/members/kickMember.ts similarity index 100% rename from helpers/members/kickMember.ts rename to plugins/bot/helpers/members/kickMember.ts diff --git a/helpers/members/mod.ts b/plugins/bot/helpers/members/mod.ts similarity index 100% rename from helpers/members/mod.ts rename to plugins/bot/helpers/members/mod.ts diff --git a/helpers/members/pruneMembers.ts b/plugins/bot/helpers/members/pruneMembers.ts similarity index 97% rename from helpers/members/pruneMembers.ts rename to plugins/bot/helpers/members/pruneMembers.ts index c214ddf02..f6c037bb0 100644 --- a/helpers/members/pruneMembers.ts +++ b/plugins/bot/helpers/members/pruneMembers.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** * Begin a prune operation. Requires the KICK_MEMBERS permission. Returns an object with one 'pruned' key indicating the number of members that were removed in the prune operation. For large guilds it's recommended to set the computePruneCount option to false, forcing 'pruned' to null. Fires multiple Guild Member Remove Gateway events. diff --git a/helpers/members/searchMembers.ts b/plugins/bot/helpers/members/searchMembers.ts similarity index 81% rename from helpers/members/searchMembers.ts rename to plugins/bot/helpers/members/searchMembers.ts index 457652f12..9d47d7ddd 100644 --- a/helpers/members/searchMembers.ts +++ b/plugins/bot/helpers/members/searchMembers.ts @@ -1,8 +1,8 @@ -import type { SearchMembers } from "../../types/discordeno.ts"; -import type { DiscordMemberWithUser } from "../../types/discord.ts"; +import type { DiscordMemberWithUser } from "../../deps.ts"; -import { Collection } from "../../util/collection.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; import { Bot } from "../../bot.ts"; +import { SearchMembers } from "../../typings.ts"; /** * Query string to match username(s) and nickname(s) against diff --git a/helpers/members/unbanMember.ts b/plugins/bot/helpers/members/unbanMember.ts similarity index 85% rename from helpers/members/unbanMember.ts rename to plugins/bot/helpers/members/unbanMember.ts index 81027d125..99148cf31 100644 --- a/helpers/members/unbanMember.ts +++ b/plugins/bot/helpers/members/unbanMember.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Remove the ban for a user. Requires BAN_MEMBERS permission */ export async function unbanMember(bot: Bot, guildId: bigint, id: bigint) { diff --git a/helpers/messages/addReaction.ts b/plugins/bot/helpers/messages/addReaction.ts similarity index 94% rename from helpers/messages/addReaction.ts rename to plugins/bot/helpers/messages/addReaction.ts index 2937cf55a..90ee655ee 100644 --- a/helpers/messages/addReaction.ts +++ b/plugins/bot/helpers/messages/addReaction.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Create a reaction for the message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. Requires READ_MESSAGE_HISTORY and ADD_REACTIONS */ export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint, reaction: string) { diff --git a/helpers/messages/addReactions.ts b/plugins/bot/helpers/messages/addReactions.ts similarity index 94% rename from helpers/messages/addReactions.ts rename to plugins/bot/helpers/messages/addReactions.ts index faffb1d11..f6dffbaf7 100644 --- a/helpers/messages/addReactions.ts +++ b/plugins/bot/helpers/messages/addReactions.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Adds multiple reactions to a message. If `ordered` is true(default is false), it will add the reactions one at a time in the order provided. Note: Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. Requires READ_MESSAGE_HISTORY and ADD_REACTIONS */ export async function addReactions( diff --git a/helpers/messages/deleteMessage.ts b/plugins/bot/helpers/messages/deleteMessage.ts similarity index 91% rename from helpers/messages/deleteMessage.ts rename to plugins/bot/helpers/messages/deleteMessage.ts index a52895fc0..89a60b198 100644 --- a/helpers/messages/deleteMessage.ts +++ b/plugins/bot/helpers/messages/deleteMessage.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete a message with the channel id and message id only. */ export async function deleteMessage( diff --git a/helpers/messages/deleteMessages.ts b/plugins/bot/helpers/messages/deleteMessages.ts similarity index 93% rename from helpers/messages/deleteMessages.ts rename to plugins/bot/helpers/messages/deleteMessages.ts index 9f05d3852..0023cd3e5 100644 --- a/helpers/messages/deleteMessages.ts +++ b/plugins/bot/helpers/messages/deleteMessages.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete messages from the channel. 2-100. Requires the MANAGE_MESSAGES permission */ export async function deleteMessages(bot: Bot, channelId: bigint, ids: bigint[], reason?: string) { diff --git a/helpers/messages/editMessage.ts b/plugins/bot/helpers/messages/editMessage.ts similarity index 94% rename from helpers/messages/editMessage.ts rename to plugins/bot/helpers/messages/editMessage.ts index e870d9ee6..f388c579b 100644 --- a/helpers/messages/editMessage.ts +++ b/plugins/bot/helpers/messages/editMessage.ts @@ -1,9 +1,8 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { Attachment } from "../../transformers/attachment.ts"; import { Embed } from "../../transformers/embed.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../types/discordeno.ts"; -import { MessageComponentTypes } from "../../types/shared.ts"; +import { DiscordMessage, FileContent, MessageComponentTypes } from "../../deps.ts"; +import { AllowedMentions, MessageComponents } from "../../typings.ts"; /** Edit the message. */ export async function editMessage(bot: Bot, channelId: bigint, messageId: bigint, content: EditMessage) { diff --git a/helpers/messages/getMessage.ts b/plugins/bot/helpers/messages/getMessage.ts similarity index 81% rename from helpers/messages/getMessage.ts rename to plugins/bot/helpers/messages/getMessage.ts index e8e736cc9..ec660dd13 100644 --- a/helpers/messages/getMessage.ts +++ b/plugins/bot/helpers/messages/getMessage.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; /** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */ export async function getMessage(bot: Bot, channelId: bigint, id: bigint) { diff --git a/helpers/messages/getMessages.ts b/plugins/bot/helpers/messages/getMessages.ts similarity index 93% rename from helpers/messages/getMessages.ts rename to plugins/bot/helpers/messages/getMessages.ts index 93968914e..55044eab7 100644 --- a/helpers/messages/getMessages.ts +++ b/plugins/bot/helpers/messages/getMessages.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; import { hasProperty } from "../../util/utils.ts"; /** Fetches between 2-100 messages. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */ diff --git a/helpers/messages/getReactions.ts b/plugins/bot/helpers/messages/getReactions.ts similarity index 86% rename from helpers/messages/getReactions.ts rename to plugins/bot/helpers/messages/getReactions.ts index 2969940de..100cc2a21 100644 --- a/helpers/messages/getReactions.ts +++ b/plugins/bot/helpers/messages/getReactions.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordUser } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordUser } from "../../deps.ts"; /** Get a list of users that reacted with this emoji. */ export async function getReactions( diff --git a/helpers/messages/mod.ts b/plugins/bot/helpers/messages/mod.ts similarity index 100% rename from helpers/messages/mod.ts rename to plugins/bot/helpers/messages/mod.ts diff --git a/helpers/messages/pinMessage.ts b/plugins/bot/helpers/messages/pinMessage.ts similarity index 87% rename from helpers/messages/pinMessage.ts rename to plugins/bot/helpers/messages/pinMessage.ts index 8665eeec8..571b892c1 100644 --- a/helpers/messages/pinMessage.ts +++ b/plugins/bot/helpers/messages/pinMessage.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Pin a message in a channel. Requires MANAGE_MESSAGES. Max pins allowed in a channel = 50. */ export async function pinMessage(bot: Bot, channelId: bigint, messageId: bigint) { diff --git a/helpers/messages/publishMessage.ts b/plugins/bot/helpers/messages/publishMessage.ts similarity index 78% rename from helpers/messages/publishMessage.ts rename to plugins/bot/helpers/messages/publishMessage.ts index 803c339a8..eb8d52bac 100644 --- a/helpers/messages/publishMessage.ts +++ b/plugins/bot/helpers/messages/publishMessage.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; /** Crosspost a message in a News Channel to following channels. */ export async function publishMessage(bot: Bot, channelId: bigint, messageId: bigint) { diff --git a/helpers/messages/removeAllReactions.ts b/plugins/bot/helpers/messages/removeAllReactions.ts similarity index 88% rename from helpers/messages/removeAllReactions.ts rename to plugins/bot/helpers/messages/removeAllReactions.ts index 9c2f6a89d..f946a0e5e 100644 --- a/helpers/messages/removeAllReactions.ts +++ b/plugins/bot/helpers/messages/removeAllReactions.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Removes all reactions for all emojis on this message. */ export async function removeAllReactions(bot: Bot, channelId: bigint, messageId: bigint) { diff --git a/helpers/messages/removeReaction.ts b/plugins/bot/helpers/messages/removeReaction.ts similarity index 95% rename from helpers/messages/removeReaction.ts rename to plugins/bot/helpers/messages/removeReaction.ts index c656c44d3..06e762794 100644 --- a/helpers/messages/removeReaction.ts +++ b/plugins/bot/helpers/messages/removeReaction.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Removes a reaction from the given user on this message, defaults to bot. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */ export async function removeReaction( diff --git a/helpers/messages/removeReactionEmoji.ts b/plugins/bot/helpers/messages/removeReactionEmoji.ts similarity index 93% rename from helpers/messages/removeReactionEmoji.ts rename to plugins/bot/helpers/messages/removeReactionEmoji.ts index a7be2349c..b0cb753a1 100644 --- a/helpers/messages/removeReactionEmoji.ts +++ b/plugins/bot/helpers/messages/removeReactionEmoji.ts @@ -1,5 +1,5 @@ /** Removes all reactions for a single emoji on this message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. */ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; export async function removeReactionEmoji(bot: Bot, channelId: bigint, messageId: bigint, reaction: string) { if (reaction.startsWith("<:")) { diff --git a/helpers/messages/sendMessage.ts b/plugins/bot/helpers/messages/sendMessage.ts similarity index 94% rename from helpers/messages/sendMessage.ts rename to plugins/bot/helpers/messages/sendMessage.ts index 169603d85..da9e962c8 100644 --- a/helpers/messages/sendMessage.ts +++ b/plugins/bot/helpers/messages/sendMessage.ts @@ -1,8 +1,7 @@ -import type { Bot } from "../../bot.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../types/mod.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { MessageComponentTypes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage, FileContent, MessageComponentTypes } from "../../deps.ts"; import { Embed } from "../../transformers/embed.ts"; +import { AllowedMentions, MessageComponents } from "../../typings.ts"; /** Send a message to the channel. Requires SEND_MESSAGES permission. */ export async function sendMessage(bot: Bot, channelId: bigint, content: CreateMessage) { diff --git a/helpers/messages/unpinMessage.ts b/plugins/bot/helpers/messages/unpinMessage.ts similarity index 86% rename from helpers/messages/unpinMessage.ts rename to plugins/bot/helpers/messages/unpinMessage.ts index 1577d00b9..5ac6623f5 100644 --- a/helpers/messages/unpinMessage.ts +++ b/plugins/bot/helpers/messages/unpinMessage.ts @@ -1,5 +1,5 @@ /** Unpin a message in a channel. Requires MANAGE_MESSAGES. */ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; export async function unpinMessage(bot: Bot, channelId: bigint, messageId: bigint) { await bot.rest.runMethod(bot.rest, "DELETE", bot.constants.routes.CHANNEL_PIN(channelId, messageId)); diff --git a/helpers/misc/editBotProfile.ts b/plugins/bot/helpers/misc/editBotProfile.ts similarity index 85% rename from helpers/misc/editBotProfile.ts rename to plugins/bot/helpers/misc/editBotProfile.ts index 8d1c1a0ad..57eb1ba2a 100644 --- a/helpers/misc/editBotProfile.ts +++ b/plugins/bot/helpers/misc/editBotProfile.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordUser } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordUser } from "../../deps.ts"; /** Modifies the bot's username or avatar. * NOTE: username: if changed may cause the bot's discriminator to be randomized. diff --git a/helpers/misc/editBotStatus.ts b/plugins/bot/helpers/misc/editBotStatus.ts similarity index 100% rename from helpers/misc/editBotStatus.ts rename to plugins/bot/helpers/misc/editBotStatus.ts diff --git a/helpers/misc/editShardStatus.ts b/plugins/bot/helpers/misc/editShardStatus.ts similarity index 96% rename from helpers/misc/editShardStatus.ts rename to plugins/bot/helpers/misc/editShardStatus.ts index 3daa23f8e..3c31262db 100644 --- a/helpers/misc/editShardStatus.ts +++ b/plugins/bot/helpers/misc/editShardStatus.ts @@ -1,7 +1,7 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; import { Activity } from "../../transformers/activity.ts"; import { StatusTypes } from "../../transformers/presence.ts"; -import { GatewayOpcodes } from "../../types/shared.ts"; +import { GatewayOpcodes } from "../../deps.ts"; export function editShardStatus(bot: Bot, shardId: number, data: StatusUpdate) { const shard = bot.gateway.manager.shards.get(shardId); diff --git a/helpers/misc/getGatewayBot.ts b/plugins/bot/helpers/misc/getGatewayBot.ts similarity index 75% rename from helpers/misc/getGatewayBot.ts rename to plugins/bot/helpers/misc/getGatewayBot.ts index 3cd5ee1c8..183946847 100644 --- a/helpers/misc/getGatewayBot.ts +++ b/plugins/bot/helpers/misc/getGatewayBot.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGetGatewayBot } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGetGatewayBot } from "../../deps.ts"; /** Get the bots Gateway metadata that can help during the operation of large or sharded bots. */ export async function getGatewayBot(bot: Bot) { diff --git a/helpers/misc/getUser.ts b/plugins/bot/helpers/misc/getUser.ts similarity index 79% rename from helpers/misc/getUser.ts rename to plugins/bot/helpers/misc/getUser.ts index 5e57051ff..ac50bf4a4 100644 --- a/helpers/misc/getUser.ts +++ b/plugins/bot/helpers/misc/getUser.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordUser } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordUser } from "../../deps.ts"; /** This function will return the raw user payload in the rare cases you need to fetch a user directly from the API. */ export async function getUser(bot: Bot, userId: bigint) { diff --git a/helpers/misc/mod.ts b/plugins/bot/helpers/misc/mod.ts similarity index 100% rename from helpers/misc/mod.ts rename to plugins/bot/helpers/misc/mod.ts diff --git a/helpers/misc/nitroStickerPacks.ts b/plugins/bot/helpers/misc/nitroStickerPacks.ts similarity index 86% rename from helpers/misc/nitroStickerPacks.ts rename to plugins/bot/helpers/misc/nitroStickerPacks.ts index 9fa147329..4c515a9e0 100644 --- a/helpers/misc/nitroStickerPacks.ts +++ b/plugins/bot/helpers/misc/nitroStickerPacks.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordStickerPack } from "../../types/discord.ts"; +import { DiscordStickerPack } from "../../deps.ts"; /** Returns the list of sticker packs available to Nitro subscribers. */ export async function nitroStickerPacks(bot: Bot) { diff --git a/helpers/mod.ts b/plugins/bot/helpers/mod.ts similarity index 100% rename from helpers/mod.ts rename to plugins/bot/helpers/mod.ts diff --git a/helpers/oauth/getApplicationInfo.ts b/plugins/bot/helpers/oauth/getApplicationInfo.ts similarity index 73% rename from helpers/oauth/getApplicationInfo.ts rename to plugins/bot/helpers/oauth/getApplicationInfo.ts index 5c0c31eb4..c7c5aa242 100644 --- a/helpers/oauth/getApplicationInfo.ts +++ b/plugins/bot/helpers/oauth/getApplicationInfo.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordApplication } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordApplication } from "../../deps.ts"; /** Get the applications info */ export async function getApplicationInfo(bot: Bot) { diff --git a/helpers/oauth/mod.ts b/plugins/bot/helpers/oauth/mod.ts similarity index 100% rename from helpers/oauth/mod.ts rename to plugins/bot/helpers/oauth/mod.ts diff --git a/helpers/roles/addRole.ts b/plugins/bot/helpers/roles/addRole.ts similarity index 88% rename from helpers/roles/addRole.ts rename to plugins/bot/helpers/roles/addRole.ts index dad10f017..52a4c9434 100644 --- a/helpers/roles/addRole.ts +++ b/plugins/bot/helpers/roles/addRole.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Add a role to the member */ export async function addRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) { diff --git a/helpers/roles/createRole.ts b/plugins/bot/helpers/roles/createRole.ts similarity index 89% rename from helpers/roles/createRole.ts rename to plugins/bot/helpers/roles/createRole.ts index 4b342b6f0..ee4a40c4f 100644 --- a/helpers/roles/createRole.ts +++ b/plugins/bot/helpers/roles/createRole.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordRole } from "../../types/discord.ts"; -import { PermissionStrings } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordRole, PermissionStrings } from "../../deps.ts"; /** Create a new role for the guild. Requires the MANAGE_ROLES permission. */ export async function createRole(bot: Bot, guildId: bigint, options: CreateGuildRole, reason?: string) { diff --git a/helpers/roles/deleteRole.ts b/plugins/bot/helpers/roles/deleteRole.ts similarity index 85% rename from helpers/roles/deleteRole.ts rename to plugins/bot/helpers/roles/deleteRole.ts index d680b576e..99ba29f9c 100644 --- a/helpers/roles/deleteRole.ts +++ b/plugins/bot/helpers/roles/deleteRole.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete a guild role. Requires the MANAGE_ROLES permission. */ export async function deleteRole(bot: Bot, guildId: bigint, id: bigint) { diff --git a/helpers/roles/editRole.ts b/plugins/bot/helpers/roles/editRole.ts similarity index 88% rename from helpers/roles/editRole.ts rename to plugins/bot/helpers/roles/editRole.ts index cd4f18753..dc7364a4e 100644 --- a/helpers/roles/editRole.ts +++ b/plugins/bot/helpers/roles/editRole.ts @@ -1,6 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordRole } from "../../types/discord.ts"; -import { PermissionStrings } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordRole, PermissionStrings } from "../../deps.ts"; /** Edit a guild role. Requires the MANAGE_ROLES permission. */ export async function editRole(bot: Bot, guildId: bigint, id: bigint, options: EditGuildRole) { diff --git a/helpers/roles/getRoles.ts b/plugins/bot/helpers/roles/getRoles.ts similarity index 78% rename from helpers/roles/getRoles.ts rename to plugins/bot/helpers/roles/getRoles.ts index a622de83e..cdaa5c36a 100644 --- a/helpers/roles/getRoles.ts +++ b/plugins/bot/helpers/roles/getRoles.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { Collection } from "../../util/collection.ts"; -import { DiscordRole } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { DiscordRole } from "../../deps.ts"; /** Returns a list of role objects for the guild. * diff --git a/helpers/roles/mod.ts b/plugins/bot/helpers/roles/mod.ts similarity index 100% rename from helpers/roles/mod.ts rename to plugins/bot/helpers/roles/mod.ts diff --git a/helpers/roles/modifyRolePositions.ts b/plugins/bot/helpers/roles/modifyRolePositions.ts similarity index 87% rename from helpers/roles/modifyRolePositions.ts rename to plugins/bot/helpers/roles/modifyRolePositions.ts index 00bedd164..d0cd8d150 100644 --- a/helpers/roles/modifyRolePositions.ts +++ b/plugins/bot/helpers/roles/modifyRolePositions.ts @@ -1,6 +1,6 @@ import { Bot } from "../../bot.ts"; -import { DiscordRole } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { DiscordRole } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; /** Modify the positions of a set of role objects for the guild. Requires the MANAGE_ROLES permission. Returns a list of all of the guild's role objects on success. Fires multiple Guild Role Update Gateway events. */ export async function modifyRolePositions(bot: Bot, guildId: bigint, options: ModifyRolePositions[]) { diff --git a/helpers/roles/removeRole.ts b/plugins/bot/helpers/roles/removeRole.ts similarity index 88% rename from helpers/roles/removeRole.ts rename to plugins/bot/helpers/roles/removeRole.ts index cc929267e..a16a0d61a 100644 --- a/helpers/roles/removeRole.ts +++ b/plugins/bot/helpers/roles/removeRole.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Remove a role from the member */ export async function removeRole(bot: Bot, guildId: bigint, memberId: bigint, roleId: bigint, reason?: string) { diff --git a/helpers/templates/createGuildFromTemplate.ts b/plugins/bot/helpers/templates/createGuildFromTemplate.ts similarity index 90% rename from helpers/templates/createGuildFromTemplate.ts rename to plugins/bot/helpers/templates/createGuildFromTemplate.ts index 7c9ba4ef8..2ca933d06 100644 --- a/helpers/templates/createGuildFromTemplate.ts +++ b/plugins/bot/helpers/templates/createGuildFromTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordGuild } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordGuild } from "../../deps.ts"; /** * Create a new guild based on a template diff --git a/helpers/templates/createGuildTemplate.ts b/plugins/bot/helpers/templates/createGuildTemplate.ts similarity index 88% rename from helpers/templates/createGuildTemplate.ts rename to plugins/bot/helpers/templates/createGuildTemplate.ts index 6bbcfee76..3abc285e5 100644 --- a/helpers/templates/createGuildTemplate.ts +++ b/plugins/bot/helpers/templates/createGuildTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** Creates a template for the guild. Requires the `MANAGE_GUILD` permission. */ export async function createGuildTemplate(bot: Bot, guildId: bigint, data: CreateTemplate) { diff --git a/helpers/templates/deleteGuildTemplate.ts b/plugins/bot/helpers/templates/deleteGuildTemplate.ts similarity index 76% rename from helpers/templates/deleteGuildTemplate.ts rename to plugins/bot/helpers/templates/deleteGuildTemplate.ts index a57c6686b..b5c97ddf6 100644 --- a/helpers/templates/deleteGuildTemplate.ts +++ b/plugins/bot/helpers/templates/deleteGuildTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** * Deletes a template from a guild. diff --git a/helpers/templates/editGuildTemplate.ts b/plugins/bot/helpers/templates/editGuildTemplate.ts similarity index 91% rename from helpers/templates/editGuildTemplate.ts rename to plugins/bot/helpers/templates/editGuildTemplate.ts index 260626ce7..1a72b0df3 100644 --- a/helpers/templates/editGuildTemplate.ts +++ b/plugins/bot/helpers/templates/editGuildTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** * Edit a template's metadata. diff --git a/helpers/templates/getGuildTemplates.ts b/plugins/bot/helpers/templates/getGuildTemplates.ts similarity index 72% rename from helpers/templates/getGuildTemplates.ts rename to plugins/bot/helpers/templates/getGuildTemplates.ts index 2830e1789..034470179 100644 --- a/helpers/templates/getGuildTemplates.ts +++ b/plugins/bot/helpers/templates/getGuildTemplates.ts @@ -1,6 +1,6 @@ -import { Collection } from "../../util/collection.ts"; -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** Returns an array of templates. Requires the `MANAGE_GUILD` permission. */ export async function getGuildTemplates(bot: Bot, guildId: bigint) { diff --git a/helpers/templates/getTemplate.ts b/plugins/bot/helpers/templates/getTemplate.ts similarity index 75% rename from helpers/templates/getTemplate.ts rename to plugins/bot/helpers/templates/getTemplate.ts index 7ce0bb0ea..9fec4dd29 100644 --- a/helpers/templates/getTemplate.ts +++ b/plugins/bot/helpers/templates/getTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** Returns the guild template if it exists */ export async function getTemplate(bot: Bot, templateCode: string) { diff --git a/helpers/templates/mod.ts b/plugins/bot/helpers/templates/mod.ts similarity index 100% rename from helpers/templates/mod.ts rename to plugins/bot/helpers/templates/mod.ts diff --git a/helpers/templates/syncGuildTemplate.ts b/plugins/bot/helpers/templates/syncGuildTemplate.ts similarity index 77% rename from helpers/templates/syncGuildTemplate.ts rename to plugins/bot/helpers/templates/syncGuildTemplate.ts index b9fc7c893..18951bf8a 100644 --- a/helpers/templates/syncGuildTemplate.ts +++ b/plugins/bot/helpers/templates/syncGuildTemplate.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordTemplate } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordTemplate } from "../../deps.ts"; /** * Syncs the template to the guild's current state. diff --git a/helpers/voice/connectToVoiceChannel.ts b/plugins/bot/helpers/voice/connectToVoiceChannel.ts similarity index 91% rename from helpers/voice/connectToVoiceChannel.ts rename to plugins/bot/helpers/voice/connectToVoiceChannel.ts index f96d0e1fe..e1f40c05c 100644 --- a/helpers/voice/connectToVoiceChannel.ts +++ b/plugins/bot/helpers/voice/connectToVoiceChannel.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { AtLeastOne, GatewayOpcodes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { AtLeastOne, GatewayOpcodes } from "../../deps.ts"; /** Connect or join a voice channel inside a guild. By default, the "selfDeaf" option is true. Requires `CONNECT` and `VIEW_CHANNEL` permissions. */ export async function connectToVoiceChannel( diff --git a/helpers/voice/mod.ts b/plugins/bot/helpers/voice/mod.ts similarity index 100% rename from helpers/voice/mod.ts rename to plugins/bot/helpers/voice/mod.ts diff --git a/helpers/webhooks/createWebhook.ts b/plugins/bot/helpers/webhooks/createWebhook.ts similarity index 91% rename from helpers/webhooks/createWebhook.ts rename to plugins/bot/helpers/webhooks/createWebhook.ts index bd3b1601e..70633b0c1 100644 --- a/helpers/webhooks/createWebhook.ts +++ b/plugins/bot/helpers/webhooks/createWebhook.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; /** * Create a new webhook. Requires the MANAGE_WEBHOOKS permission. Returns a webhook object on success. Webhook names follow our naming restrictions that can be found in our Usernames and Nicknames documentation, with the following additional stipulations: diff --git a/helpers/webhooks/deleteWebhook.ts b/plugins/bot/helpers/webhooks/deleteWebhook.ts similarity index 88% rename from helpers/webhooks/deleteWebhook.ts rename to plugins/bot/helpers/webhooks/deleteWebhook.ts index 10b2946fd..09e0ba63d 100644 --- a/helpers/webhooks/deleteWebhook.ts +++ b/plugins/bot/helpers/webhooks/deleteWebhook.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete a webhook permanently. Requires the `MANAGE_WEBHOOKS` permission. Returns a undefined on success */ export async function deleteWebhook(bot: Bot, webhookId: bigint, reason?: string) { diff --git a/helpers/webhooks/deleteWebhookMessage.ts b/plugins/bot/helpers/webhooks/deleteWebhookMessage.ts similarity index 91% rename from helpers/webhooks/deleteWebhookMessage.ts rename to plugins/bot/helpers/webhooks/deleteWebhookMessage.ts index 2cbfcec28..d36c31115 100644 --- a/helpers/webhooks/deleteWebhookMessage.ts +++ b/plugins/bot/helpers/webhooks/deleteWebhookMessage.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; export interface DeleteWebhookMessageOptions { /** id of the thread the message is in */ diff --git a/helpers/webhooks/deleteWebhookWithToken.ts b/plugins/bot/helpers/webhooks/deleteWebhookWithToken.ts similarity index 87% rename from helpers/webhooks/deleteWebhookWithToken.ts rename to plugins/bot/helpers/webhooks/deleteWebhookWithToken.ts index dcfe27453..604e997b2 100644 --- a/helpers/webhooks/deleteWebhookWithToken.ts +++ b/plugins/bot/helpers/webhooks/deleteWebhookWithToken.ts @@ -1,4 +1,4 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; /** Delete a webhook permanently. Returns a undefined on success */ export async function deleteWebhookWithToken(bot: Bot, webhookId: bigint, webhookToken: string) { diff --git a/helpers/webhooks/editWebhook.ts b/plugins/bot/helpers/webhooks/editWebhook.ts similarity index 89% rename from helpers/webhooks/editWebhook.ts rename to plugins/bot/helpers/webhooks/editWebhook.ts index 696cf60ef..9700d00ed 100644 --- a/helpers/webhooks/editWebhook.ts +++ b/plugins/bot/helpers/webhooks/editWebhook.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; /** Edit a webhook. Requires the `MANAGE_WEBHOOKS` permission. Returns the updated webhook object on success. */ export async function editWebhook(bot: Bot, webhookId: bigint, options: ModifyWebhook) { diff --git a/helpers/webhooks/editWebhookMessage.ts b/plugins/bot/helpers/webhooks/editWebhookMessage.ts similarity index 94% rename from helpers/webhooks/editWebhookMessage.ts rename to plugins/bot/helpers/webhooks/editWebhookMessage.ts index 05fb18bd5..f9daae7ef 100644 --- a/helpers/webhooks/editWebhookMessage.ts +++ b/plugins/bot/helpers/webhooks/editWebhookMessage.ts @@ -1,9 +1,8 @@ -import type { Bot } from "../../bot.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../types/discordeno.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { MessageComponentTypes } from "../../types/shared.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage, FileContent, MessageComponentTypes } from "../../deps.ts"; import { Attachment } from "../../transformers/attachment.ts"; import { Embed } from "../../transformers/embed.ts"; +import { AllowedMentions, MessageComponents } from "../../typings.ts"; export async function editWebhookMessage( bot: Bot, diff --git a/helpers/webhooks/editWebhookWithToken.ts b/plugins/bot/helpers/webhooks/editWebhookWithToken.ts similarity index 84% rename from helpers/webhooks/editWebhookWithToken.ts rename to plugins/bot/helpers/webhooks/editWebhookWithToken.ts index 5ceccac6b..965945092 100644 --- a/helpers/webhooks/editWebhookWithToken.ts +++ b/plugins/bot/helpers/webhooks/editWebhookWithToken.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; import { ModifyWebhook } from "./editWebhook.ts"; /** Edit a webhook. Returns the updated webhook object on success. */ diff --git a/helpers/webhooks/getWebhook.ts b/plugins/bot/helpers/webhooks/getWebhook.ts similarity index 77% rename from helpers/webhooks/getWebhook.ts rename to plugins/bot/helpers/webhooks/getWebhook.ts index 690bf0355..4d1f352c0 100644 --- a/helpers/webhooks/getWebhook.ts +++ b/plugins/bot/helpers/webhooks/getWebhook.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; /** Returns the new webhook object for the given id. */ export async function getWebhook(bot: Bot, webhookId: bigint) { diff --git a/helpers/webhooks/getWebhookMessage.ts b/plugins/bot/helpers/webhooks/getWebhookMessage.ts similarity index 85% rename from helpers/webhooks/getWebhookMessage.ts rename to plugins/bot/helpers/webhooks/getWebhookMessage.ts index 4b0b4e828..f54bc0d3b 100644 --- a/helpers/webhooks/getWebhookMessage.ts +++ b/plugins/bot/helpers/webhooks/getWebhookMessage.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMessage } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage } from "../../deps.ts"; export interface GetWebhookMessageOptions { threadId: bigint; diff --git a/helpers/webhooks/getWebhookWithToken.ts b/plugins/bot/helpers/webhooks/getWebhookWithToken.ts similarity index 81% rename from helpers/webhooks/getWebhookWithToken.ts rename to plugins/bot/helpers/webhooks/getWebhookWithToken.ts index e5a9d3500..3eb97e0c5 100644 --- a/helpers/webhooks/getWebhookWithToken.ts +++ b/plugins/bot/helpers/webhooks/getWebhookWithToken.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; /** Returns the new webhook object for the given id, this call does not require authentication and returns no user in the webhook object. */ export async function getWebhookWithToken(bot: Bot, webhookId: bigint, token: string) { diff --git a/helpers/webhooks/getWebhooks.ts b/plugins/bot/helpers/webhooks/getWebhooks.ts similarity index 73% rename from helpers/webhooks/getWebhooks.ts rename to plugins/bot/helpers/webhooks/getWebhooks.ts index d58889ec1..fd0a8b817 100644 --- a/helpers/webhooks/getWebhooks.ts +++ b/plugins/bot/helpers/webhooks/getWebhooks.ts @@ -1,6 +1,6 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordWebhook } from "../../types/discord.ts"; -import { Collection } from "../../util/collection.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordWebhook } from "../../deps.ts"; +import { BotCollection as Collection } from "../../util/collection.ts"; /** Returns a list of guild webhooks objects. Requires the MANAGE_WEBHOOKs permission. */ export async function getWebhooks(bot: Bot, guildId: bigint) { diff --git a/helpers/webhooks/mod.ts b/plugins/bot/helpers/webhooks/mod.ts similarity index 100% rename from helpers/webhooks/mod.ts rename to plugins/bot/helpers/webhooks/mod.ts diff --git a/helpers/webhooks/sendWebhook.ts b/plugins/bot/helpers/webhooks/sendWebhook.ts similarity index 92% rename from helpers/webhooks/sendWebhook.ts rename to plugins/bot/helpers/webhooks/sendWebhook.ts index fcd1fe8dc..778ca9038 100644 --- a/helpers/webhooks/sendWebhook.ts +++ b/plugins/bot/helpers/webhooks/sendWebhook.ts @@ -1,7 +1,7 @@ -import type { Bot } from "../../bot.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMessage, FileContent } from "../../deps.ts"; import { Embed } from "../../transformers/embed.ts"; -import { DiscordMessage } from "../../types/discord.ts"; -import { AllowedMentions, FileContent, MessageComponents } from "../../types/discordeno.ts"; +import { AllowedMentions, MessageComponents } from "../../typings.ts"; /** Send a webhook with webhook Id and webhook token */ export async function sendWebhook(bot: Bot, webhookId: bigint, webhookToken: string, options: ExecuteWebhook) { diff --git a/plugins/bot/mod.ts b/plugins/bot/mod.ts new file mode 100644 index 000000000..c6791bb95 --- /dev/null +++ b/plugins/bot/mod.ts @@ -0,0 +1,8 @@ +export * from "./handlers/mod.ts"; +export * from "./helpers/mod.ts"; +export * from "./transformers/mod.ts"; +export * from "./util/mod.ts"; +export * from "./bot.ts"; +export * from "./typings.ts"; +// This will export everything from discordeno as well. Makes it easier to use. +export * from "./deps.ts"; diff --git a/transformers/activity.ts b/plugins/bot/transformers/activity.ts similarity index 92% rename from transformers/activity.ts rename to plugins/bot/transformers/activity.ts index 51744ead2..649828f31 100644 --- a/transformers/activity.ts +++ b/plugins/bot/transformers/activity.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordActivity } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordActivity, Optionalize } from "../deps.ts"; export function transformActivity(bot: Bot, payload: DiscordActivity) { const activity = { diff --git a/transformers/application.ts b/plugins/bot/transformers/application.ts similarity index 91% rename from transformers/application.ts rename to plugins/bot/transformers/application.ts index 16a1f0e4a..85d61975f 100644 --- a/transformers/application.ts +++ b/plugins/bot/transformers/application.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordApplication } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordApplication, Optionalize } from "../deps.ts"; export function transformApplication(bot: Bot, payload: DiscordApplication) { const application = { diff --git a/transformers/applicationCommand.ts b/plugins/bot/transformers/applicationCommand.ts similarity index 90% rename from transformers/applicationCommand.ts rename to plugins/bot/transformers/applicationCommand.ts index f1cad2182..a69651c53 100644 --- a/transformers/applicationCommand.ts +++ b/plugins/bot/transformers/applicationCommand.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordApplicationCommand } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordApplicationCommand, Optionalize } from "../deps.ts"; export function transformApplicationCommand(bot: Bot, payload: DiscordApplicationCommand) { const applicationCommand = { diff --git a/transformers/applicationCommandOption.ts b/plugins/bot/transformers/applicationCommandOption.ts similarity index 89% rename from transformers/applicationCommandOption.ts rename to plugins/bot/transformers/applicationCommandOption.ts index 38f1d7c94..f58abc186 100644 --- a/transformers/applicationCommandOption.ts +++ b/plugins/bot/transformers/applicationCommandOption.ts @@ -1,7 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordApplicationCommandOption, DiscordApplicationCommandOptionChoice } from "../types/discord.ts"; -import { ApplicationCommandOptionTypes, ChannelTypes, Localization } from "../types/shared.ts"; -import { Optionalize } from "../types/shared.ts"; +import { ApplicationCommandOptionTypes, ChannelTypes, DiscordApplicationCommandOption, Localization } from "../deps.ts"; import { ApplicationCommandOptionChoice } from "./applicationCommandOptionChoice.ts"; export function transformApplicationCommandOption( diff --git a/transformers/applicationCommandOptionChoice.ts b/plugins/bot/transformers/applicationCommandOptionChoice.ts similarity index 77% rename from transformers/applicationCommandOptionChoice.ts rename to plugins/bot/transformers/applicationCommandOptionChoice.ts index edbaf6167..31f3c1f16 100644 --- a/transformers/applicationCommandOptionChoice.ts +++ b/plugins/bot/transformers/applicationCommandOptionChoice.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordApplicationCommandOptionChoice } from "../types/discord.ts"; -import { Camelize, Localization, Optionalize } from "../types/shared.ts"; +import { DiscordApplicationCommandOptionChoice, Optionalize } from "../deps.ts"; export function transformApplicationCommandOptionChoice(bot: Bot, payload: DiscordApplicationCommandOptionChoice) { const applicationCommandChoice = { diff --git a/transformers/applicationCommandPermission.ts b/plugins/bot/transformers/applicationCommandPermission.ts similarity index 85% rename from transformers/applicationCommandPermission.ts rename to plugins/bot/transformers/applicationCommandPermission.ts index 6e8b0f9cd..11ffbe6ee 100644 --- a/transformers/applicationCommandPermission.ts +++ b/plugins/bot/transformers/applicationCommandPermission.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordGuildApplicationCommandPermissions } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordGuildApplicationCommandPermissions, Optionalize } from "../deps.ts"; export function transformApplicationCommandPermission(bot: Bot, payload: DiscordGuildApplicationCommandPermissions) { const applicationCommandPermission = { diff --git a/transformers/attachment.ts b/plugins/bot/transformers/attachment.ts similarity index 84% rename from transformers/attachment.ts rename to plugins/bot/transformers/attachment.ts index 370f56dab..82d425f5e 100644 --- a/transformers/attachment.ts +++ b/plugins/bot/transformers/attachment.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordAttachment } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordAttachment, Optionalize } from "../deps.ts"; export function transformAttachment(bot: Bot, payload: DiscordAttachment) { const attachment = { diff --git a/transformers/auditLogEntry.ts b/plugins/bot/transformers/auditLogEntry.ts similarity index 97% rename from transformers/auditLogEntry.ts rename to plugins/bot/transformers/auditLogEntry.ts index 398d1518b..31f8687f8 100644 --- a/transformers/auditLogEntry.ts +++ b/plugins/bot/transformers/auditLogEntry.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordAuditLogEntry } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordAuditLogEntry, Optionalize } from "../deps.ts"; export function transformAuditLogEntry(bot: Bot, payload: DiscordAuditLogEntry) { const auditLogEntry = { diff --git a/transformers/automodActionExecution.ts b/plugins/bot/transformers/automodActionExecution.ts similarity index 91% rename from transformers/automodActionExecution.ts rename to plugins/bot/transformers/automodActionExecution.ts index bc8712087..ece01b9a9 100644 --- a/transformers/automodActionExecution.ts +++ b/plugins/bot/transformers/automodActionExecution.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordAutoModerationActionExecution } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordAutoModerationActionExecution, Optionalize } from "../deps.ts"; export function transformAutoModerationActionExecution(bot: Bot, payload: DiscordAutoModerationActionExecution) { const rule = { diff --git a/transformers/automodRule.ts b/plugins/bot/transformers/automodRule.ts similarity index 91% rename from transformers/automodRule.ts rename to plugins/bot/transformers/automodRule.ts index 0d77c3346..46344a35d 100644 --- a/transformers/automodRule.ts +++ b/plugins/bot/transformers/automodRule.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordAutoModerationRule } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordAutoModerationRule, Optionalize } from "../deps.ts"; export function transformAutoModerationRule(bot: Bot, payload: DiscordAutoModerationRule) { const rule = { diff --git a/transformers/channel.ts b/plugins/bot/transformers/channel.ts similarity index 97% rename from transformers/channel.ts rename to plugins/bot/transformers/channel.ts index ccbe70887..42cf9cee4 100644 --- a/transformers/channel.ts +++ b/plugins/bot/transformers/channel.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordChannel } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordChannel, Optionalize } from "../deps.ts"; const Mask = (1n << 64n) - 1n; diff --git a/transformers/component.ts b/plugins/bot/transformers/component.ts similarity index 94% rename from transformers/component.ts rename to plugins/bot/transformers/component.ts index 9ee322ac8..bb5c64c16 100644 --- a/transformers/component.ts +++ b/plugins/bot/transformers/component.ts @@ -1,6 +1,6 @@ import { Bot } from "../bot.ts"; -import { ButtonStyles, MessageComponentTypes, SelectOption, TextStyles } from "../mod.ts"; -import { DiscordComponent } from "../types/discord.ts"; +import { ButtonStyles, DiscordComponent, MessageComponentTypes, TextStyles } from "../deps.ts"; +import { SelectOption } from "../typings.ts"; export function transformComponent(bot: Bot, payload: DiscordComponent): Component { return { diff --git a/transformers/embed.ts b/plugins/bot/transformers/embed.ts similarity index 93% rename from transformers/embed.ts rename to plugins/bot/transformers/embed.ts index bab34f0e2..2b99e1a70 100644 --- a/transformers/embed.ts +++ b/plugins/bot/transformers/embed.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordEmbed } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordEmbed, Optionalize } from "../deps.ts"; export function transformEmbed(bot: Bot, payload: DiscordEmbed) { const embed = { diff --git a/transformers/emoji.ts b/plugins/bot/transformers/emoji.ts similarity index 85% rename from transformers/emoji.ts rename to plugins/bot/transformers/emoji.ts index b3214b914..fa824350a 100644 --- a/transformers/emoji.ts +++ b/plugins/bot/transformers/emoji.ts @@ -1,7 +1,6 @@ import { Bot } from "../bot.ts"; -import { DiscordEmoji } from "../types/discord.ts"; +import { DiscordEmoji, Optionalize } from "../deps.ts"; import { EmojiToggles } from "./toggles/emoji.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformEmoji(bot: Bot, payload: DiscordEmoji) { const emoji = { diff --git a/transformers/gatewayBot.ts b/plugins/bot/transformers/gatewayBot.ts similarity index 83% rename from transformers/gatewayBot.ts rename to plugins/bot/transformers/gatewayBot.ts index be7f40f21..3ec730c0b 100644 --- a/transformers/gatewayBot.ts +++ b/plugins/bot/transformers/gatewayBot.ts @@ -1,5 +1,4 @@ -import { DiscordGetGatewayBot } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordGetGatewayBot, Optionalize } from "../deps.ts"; export function transformGatewayBot(payload: DiscordGetGatewayBot) { const gatewayBot = { diff --git a/transformers/guild.ts b/plugins/bot/transformers/guild.ts similarity index 96% rename from transformers/guild.ts rename to plugins/bot/transformers/guild.ts index 788e2e77a..b26295084 100644 --- a/transformers/guild.ts +++ b/plugins/bot/transformers/guild.ts @@ -1,9 +1,8 @@ import type { Emoji } from "../transformers/emoji.ts"; import { Bot } from "../bot.ts"; -import { Collection } from "../util/collection.ts"; -import { DiscordGuild } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { BotCollection as Collection } from "../util/collection.ts"; import { GuildToggles } from "./toggles/guild.ts"; +import { DiscordGuild, Optionalize } from "../deps.ts"; export function transformGuild(bot: Bot, payload: { guild: DiscordGuild } & { shardId: number }) { const guildId = bot.transformers.snowflake(payload.guild.id); diff --git a/transformers/integration.ts b/plugins/bot/transformers/integration.ts similarity index 92% rename from transformers/integration.ts rename to plugins/bot/transformers/integration.ts index 1098fe211..c8bcc63e8 100644 --- a/transformers/integration.ts +++ b/plugins/bot/transformers/integration.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordIntegrationCreateUpdate } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordIntegrationCreateUpdate, Optionalize } from "../deps.ts"; export function transformIntegration(bot: Bot, payload: DiscordIntegrationCreateUpdate) { const integration = { diff --git a/transformers/interaction.ts b/plugins/bot/transformers/interaction.ts similarity index 96% rename from transformers/interaction.ts rename to plugins/bot/transformers/interaction.ts index eb8f8292f..9b8ff3228 100644 --- a/transformers/interaction.ts +++ b/plugins/bot/transformers/interaction.ts @@ -1,17 +1,17 @@ import { Bot } from "../bot.ts"; import { + ChannelTypes, DiscordAttachment, DiscordInteraction, DiscordInteractionDataOption, DiscordInteractionDataResolved, -} from "../types/discord.ts"; -import { ChannelTypes } from "../types/shared.ts"; -import { Collection } from "../util/collection.ts"; + Optionalize, +} from "../deps.ts"; +import { BotCollection as Collection } from "../util/collection.ts"; import { Attachment } from "./attachment.ts"; import { Member, User } from "./member.ts"; import { Message } from "./message.ts"; import { Role } from "./role.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformInteraction(bot: Bot, payload: DiscordInteraction) { const guildId = payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined; diff --git a/transformers/invite.ts b/plugins/bot/transformers/invite.ts similarity index 94% rename from transformers/invite.ts rename to plugins/bot/transformers/invite.ts index 19364bd64..37764002c 100644 --- a/transformers/invite.ts +++ b/plugins/bot/transformers/invite.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordInviteCreate } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordInviteCreate, Optionalize } from "../deps.ts"; export function transformInvite(bot: Bot, invite: DiscordInviteCreate) { const transformedInvite = { diff --git a/transformers/member.ts b/plugins/bot/transformers/member.ts similarity index 91% rename from transformers/member.ts rename to plugins/bot/transformers/member.ts index 48b8bcdb0..341c9cb83 100644 --- a/transformers/member.ts +++ b/plugins/bot/transformers/member.ts @@ -1,8 +1,7 @@ -import type { Bot } from "../bot.ts"; -import { DiscordMember, DiscordUser } from "../types/discord.ts"; +import { Bot } from "../bot.ts"; +import { DiscordMember, DiscordUser, Optionalize } from "../deps.ts"; import { MemberToggles } from "./toggles/member.ts"; import { UserToggles } from "./toggles/user.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformUser(bot: Bot, payload: DiscordUser) { const user = { diff --git a/transformers/message.ts b/plugins/bot/transformers/message.ts similarity index 96% rename from transformers/message.ts rename to plugins/bot/transformers/message.ts index 4a0c421a8..8c56b489f 100644 --- a/transformers/message.ts +++ b/plugins/bot/transformers/message.ts @@ -1,8 +1,6 @@ import { Bot } from "../bot.ts"; -import { DiscordMessage } from "../types/discord.ts"; -import { CHANNEL_MENTION_REGEX } from "../util/constants.ts"; +import { CHANNEL_MENTION_REGEX, DiscordMessage, Optionalize } from "../deps.ts"; import { MemberToggles } from "./toggles/member.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformMessage(bot: Bot, payload: DiscordMessage) { const guildId = payload.guild_id ? bot.transformers.snowflake(payload.guild_id) : undefined; diff --git a/transformers/mod.ts b/plugins/bot/transformers/mod.ts similarity index 100% rename from transformers/mod.ts rename to plugins/bot/transformers/mod.ts diff --git a/transformers/presence.ts b/plugins/bot/transformers/presence.ts similarity index 92% rename from transformers/presence.ts rename to plugins/bot/transformers/presence.ts index 403ff7e3e..34f79a806 100644 --- a/transformers/presence.ts +++ b/plugins/bot/transformers/presence.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordPresenceUpdate } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordPresenceUpdate, Optionalize } from "../deps.ts"; import { UserToggles } from "./toggles/user.ts"; export const statusTypes = Object.freeze({ diff --git a/transformers/reverse/activity.ts b/plugins/bot/transformers/reverse/activity.ts similarity index 95% rename from transformers/reverse/activity.ts rename to plugins/bot/transformers/reverse/activity.ts index a5c8a6335..945fa4ec4 100644 --- a/transformers/reverse/activity.ts +++ b/plugins/bot/transformers/reverse/activity.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordActivity } from "../../types/discord.ts"; +import { DiscordActivity } from "../../deps.ts"; import { Activity } from "../activity.ts"; export function transformActivityToDiscordActivity(bot: Bot, payload: Activity): DiscordActivity { diff --git a/transformers/reverse/allowedMentions.ts b/plugins/bot/transformers/reverse/allowedMentions.ts similarity index 69% rename from transformers/reverse/allowedMentions.ts rename to plugins/bot/transformers/reverse/allowedMentions.ts index 690a68fd0..529b6ed7f 100644 --- a/transformers/reverse/allowedMentions.ts +++ b/plugins/bot/transformers/reverse/allowedMentions.ts @@ -1,4 +1,6 @@ -import { AllowedMentions, Bot, DiscordAllowedMentions } from "../../mod.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordAllowedMentions } from "../../deps.ts"; +import { AllowedMentions } from "../../typings.ts"; export function transformAllowedMentionsToDiscordAllowedMentions( bot: Bot, diff --git a/transformers/reverse/application.ts b/plugins/bot/transformers/reverse/application.ts similarity index 94% rename from transformers/reverse/application.ts rename to plugins/bot/transformers/reverse/application.ts index db746e255..54d28ca8f 100644 --- a/transformers/reverse/application.ts +++ b/plugins/bot/transformers/reverse/application.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordApplication } from "../../types/discord.ts"; +import { DiscordApplication } from "../../deps.ts"; import { Application } from "../application.ts"; export function transformApplicationToDiscordApplication(bot: Bot, payload: Application): DiscordApplication { diff --git a/transformers/reverse/component.ts b/plugins/bot/transformers/reverse/component.ts similarity index 95% rename from transformers/reverse/component.ts rename to plugins/bot/transformers/reverse/component.ts index 7d142b156..360f353d1 100644 --- a/transformers/reverse/component.ts +++ b/plugins/bot/transformers/reverse/component.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordComponent } from "../../types/discord.ts"; +import { DiscordComponent } from "../../deps.ts"; import { Component } from "../component.ts"; export function transformComponentToDiscordComponent(bot: Bot, payload: Component): DiscordComponent { diff --git a/transformers/reverse/embed.ts b/plugins/bot/transformers/reverse/embed.ts similarity index 96% rename from transformers/reverse/embed.ts rename to plugins/bot/transformers/reverse/embed.ts index 02bc31fdd..00d9db114 100644 --- a/transformers/reverse/embed.ts +++ b/plugins/bot/transformers/reverse/embed.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordEmbed } from "../../types/discord.ts"; +import { DiscordEmbed } from "../../deps.ts"; import { Embed } from "../embed.ts"; export function transformEmbedToDiscordEmbed(bot: Bot, payload: Embed): DiscordEmbed { diff --git a/transformers/reverse/member.ts b/plugins/bot/transformers/reverse/member.ts similarity index 93% rename from transformers/reverse/member.ts rename to plugins/bot/transformers/reverse/member.ts index c3aa8aa18..566cf4333 100644 --- a/transformers/reverse/member.ts +++ b/plugins/bot/transformers/reverse/member.ts @@ -1,5 +1,5 @@ -import type { Bot } from "../../bot.ts"; -import { DiscordMember, DiscordUser } from "../../types/discord.ts"; +import { Bot } from "../../bot.ts"; +import { DiscordMember, DiscordUser } from "../../deps.ts"; import { Member, User } from "../member.ts"; export function transformUserToDiscordUser(bot: Bot, payload: User): DiscordUser { diff --git a/transformers/reverse/mod.ts b/plugins/bot/transformers/reverse/mod.ts similarity index 100% rename from transformers/reverse/mod.ts rename to plugins/bot/transformers/reverse/mod.ts diff --git a/transformers/reverse/team.ts b/plugins/bot/transformers/reverse/team.ts similarity index 92% rename from transformers/reverse/team.ts rename to plugins/bot/transformers/reverse/team.ts index dd3ad6f99..496c34ffe 100644 --- a/transformers/reverse/team.ts +++ b/plugins/bot/transformers/reverse/team.ts @@ -1,5 +1,5 @@ import { Bot } from "../../bot.ts"; -import { DiscordTeam } from "../../types/discord.ts"; +import { DiscordTeam } from "../../deps.ts"; import { Team } from "../team.ts"; export function transformTeamToDiscordTeam(bot: Bot, payload: Team): DiscordTeam { diff --git a/transformers/role.ts b/plugins/bot/transformers/role.ts similarity index 90% rename from transformers/role.ts rename to plugins/bot/transformers/role.ts index f5a9f05a6..2816d5cb8 100644 --- a/transformers/role.ts +++ b/plugins/bot/transformers/role.ts @@ -1,7 +1,6 @@ import { Bot } from "../bot.ts"; -import { DiscordRole } from "../types/discord.ts"; +import { DiscordRole, Optionalize } from "../deps.ts"; import { RoleToggles } from "./toggles/role.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformRole(bot: Bot, payload: { role: DiscordRole } & { guildId: bigint }) { const role = { diff --git a/transformers/scheduledEvent.ts b/plugins/bot/transformers/scheduledEvent.ts similarity index 92% rename from transformers/scheduledEvent.ts rename to plugins/bot/transformers/scheduledEvent.ts index 8c6bc08f9..571c314f0 100644 --- a/transformers/scheduledEvent.ts +++ b/plugins/bot/transformers/scheduledEvent.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordScheduledEvent } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordScheduledEvent, Optionalize } from "../deps.ts"; export function transformScheduledEvent( bot: Bot, diff --git a/transformers/stageInstance.ts b/plugins/bot/transformers/stageInstance.ts similarity index 85% rename from transformers/stageInstance.ts rename to plugins/bot/transformers/stageInstance.ts index a88cdbe9a..d00c68ca9 100644 --- a/transformers/stageInstance.ts +++ b/plugins/bot/transformers/stageInstance.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordStageInstance } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordStageInstance, Optionalize } from "../deps.ts"; export function transformStageInstance(bot: Bot, payload: DiscordStageInstance) { const stageInstance = { diff --git a/transformers/sticker.ts b/plugins/bot/transformers/sticker.ts similarity index 92% rename from transformers/sticker.ts rename to plugins/bot/transformers/sticker.ts index bbf6f6f83..7e6efdeed 100644 --- a/transformers/sticker.ts +++ b/plugins/bot/transformers/sticker.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordSticker, DiscordStickerPack } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordSticker, DiscordStickerPack, Optionalize } from "../deps.ts"; export function transformSticker(bot: Bot, payload: DiscordSticker) { const sticker = { diff --git a/transformers/team.ts b/plugins/bot/transformers/team.ts similarity index 87% rename from transformers/team.ts rename to plugins/bot/transformers/team.ts index 09a6a4e8a..b23f2a975 100644 --- a/transformers/team.ts +++ b/plugins/bot/transformers/team.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordTeam } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordTeam, Optionalize } from "../deps.ts"; export function transformTeam(bot: Bot, payload: DiscordTeam) { const id = bot.transformers.snowflake(payload.id); diff --git a/transformers/template.ts b/plugins/bot/transformers/template.ts similarity index 88% rename from transformers/template.ts rename to plugins/bot/transformers/template.ts index af76569b1..d915b85be 100644 --- a/transformers/template.ts +++ b/plugins/bot/transformers/template.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordTemplate } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordTemplate, Optionalize } from "../deps.ts"; export function transformTemplate(bot: Bot, payload: DiscordTemplate) { const template = { diff --git a/transformers/threadMember.ts b/plugins/bot/transformers/threadMember.ts similarity index 85% rename from transformers/threadMember.ts rename to plugins/bot/transformers/threadMember.ts index 8be600172..31190cc6e 100644 --- a/transformers/threadMember.ts +++ b/plugins/bot/transformers/threadMember.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordThreadMember, DiscordThreadMemberGuildCreate } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordThreadMember, DiscordThreadMemberGuildCreate, Optionalize } from "../deps.ts"; export function transformThreadMember(bot: Bot, payload: DiscordThreadMember) { const threadMember = { diff --git a/transformers/toggles/ToggleBitfield.ts b/plugins/bot/transformers/toggles/ToggleBitfield.ts similarity index 100% rename from transformers/toggles/ToggleBitfield.ts rename to plugins/bot/transformers/toggles/ToggleBitfield.ts diff --git a/transformers/toggles/emoji.ts b/plugins/bot/transformers/toggles/emoji.ts similarity index 96% rename from transformers/toggles/emoji.ts rename to plugins/bot/transformers/toggles/emoji.ts index 43bdd1cd2..c0ec54efd 100644 --- a/transformers/toggles/emoji.ts +++ b/plugins/bot/transformers/toggles/emoji.ts @@ -1,4 +1,4 @@ -import { DiscordEmoji, DiscordRole } from "../../types/discord.ts"; +import { DiscordEmoji } from "../../deps.ts"; import { ToggleBitfield } from "./ToggleBitfield.ts"; export const EmojiToggle = { diff --git a/transformers/toggles/guild.ts b/plugins/bot/transformers/toggles/guild.ts similarity index 98% rename from transformers/toggles/guild.ts rename to plugins/bot/transformers/toggles/guild.ts index 5a1cfc59a..fdb21363f 100644 --- a/transformers/toggles/guild.ts +++ b/plugins/bot/transformers/toggles/guild.ts @@ -1,6 +1,5 @@ -import { DiscordGuild } from "../../types/discord.ts"; -import { GuildFeatures } from "../../types/shared.ts"; -import { ToggleBitfield, ToggleBitfieldBigint } from "./ToggleBitfield.ts"; +import { DiscordGuild, GuildFeatures } from "../../deps.ts"; +import { ToggleBitfieldBigint } from "./ToggleBitfield.ts"; export const GuildToggle = { /** Whether the bot is the owner of the guild */ diff --git a/transformers/toggles/member.ts b/plugins/bot/transformers/toggles/member.ts similarity index 95% rename from transformers/toggles/member.ts rename to plugins/bot/transformers/toggles/member.ts index f37cf0c91..d1df6d64f 100644 --- a/transformers/toggles/member.ts +++ b/plugins/bot/transformers/toggles/member.ts @@ -1,4 +1,4 @@ -import { DiscordMember, DiscordUser } from "../../types/discord.ts"; +import { DiscordMember } from "../../deps.ts"; import { ToggleBitfield } from "./ToggleBitfield.ts"; export const MemberToggle = { diff --git a/transformers/toggles/mod.ts b/plugins/bot/transformers/toggles/mod.ts similarity index 100% rename from transformers/toggles/mod.ts rename to plugins/bot/transformers/toggles/mod.ts diff --git a/transformers/toggles/role.ts b/plugins/bot/transformers/toggles/role.ts similarity index 97% rename from transformers/toggles/role.ts rename to plugins/bot/transformers/toggles/role.ts index 1325f74e6..dec1b3e93 100644 --- a/transformers/toggles/role.ts +++ b/plugins/bot/transformers/toggles/role.ts @@ -1,4 +1,4 @@ -import { DiscordRole } from "../../types/discord.ts"; +import { DiscordRole } from "../../deps.ts"; import { ToggleBitfield } from "./ToggleBitfield.ts"; export const RoleToggle = { diff --git a/transformers/toggles/user.ts b/plugins/bot/transformers/toggles/user.ts similarity index 97% rename from transformers/toggles/user.ts rename to plugins/bot/transformers/toggles/user.ts index 91267464d..af3801209 100644 --- a/transformers/toggles/user.ts +++ b/plugins/bot/transformers/toggles/user.ts @@ -1,4 +1,4 @@ -import { DiscordUser } from "../../types/discord.ts"; +import { DiscordUser } from "../../deps.ts"; import { ToggleBitfield } from "./ToggleBitfield.ts"; export const UserToggle = { diff --git a/transformers/toggles/voice.ts b/plugins/bot/transformers/toggles/voice.ts similarity index 97% rename from transformers/toggles/voice.ts rename to plugins/bot/transformers/toggles/voice.ts index 17fc70441..2e0b0694d 100644 --- a/transformers/toggles/voice.ts +++ b/plugins/bot/transformers/toggles/voice.ts @@ -1,4 +1,4 @@ -import { DiscordUser, DiscordVoiceState } from "../../types/discord.ts"; +import { DiscordVoiceState } from "../../deps.ts"; import { ToggleBitfield } from "./ToggleBitfield.ts"; export const VoiceStateToggle = { diff --git a/transformers/voiceRegion.ts b/plugins/bot/transformers/voiceRegion.ts similarity index 79% rename from transformers/voiceRegion.ts rename to plugins/bot/transformers/voiceRegion.ts index db128de09..a4cb8eda9 100644 --- a/transformers/voiceRegion.ts +++ b/plugins/bot/transformers/voiceRegion.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordVoiceRegion } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordVoiceRegion, Optionalize } from "../deps.ts"; export function transformVoiceRegion(bot: Bot, payload: DiscordVoiceRegion) { const voiceRegion = { diff --git a/transformers/voiceState.ts b/plugins/bot/transformers/voiceState.ts similarity index 90% rename from transformers/voiceState.ts rename to plugins/bot/transformers/voiceState.ts index 7a032095f..56017f297 100644 --- a/transformers/voiceState.ts +++ b/plugins/bot/transformers/voiceState.ts @@ -1,7 +1,6 @@ import { Bot } from "../bot.ts"; -import { DiscordVoiceState } from "../types/discord.ts"; +import { DiscordVoiceState, Optionalize } from "../deps.ts"; import { VoiceStateToggles } from "./toggles/voice.ts"; -import { Optionalize } from "../types/shared.ts"; export function transformVoiceState(bot: Bot, payload: { voiceState: DiscordVoiceState } & { guildId: bigint }) { const voiceState = { diff --git a/transformers/webhook.ts b/plugins/bot/transformers/webhook.ts similarity index 93% rename from transformers/webhook.ts rename to plugins/bot/transformers/webhook.ts index 52398ed02..cadc87b66 100644 --- a/transformers/webhook.ts +++ b/plugins/bot/transformers/webhook.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordWebhook } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordWebhook, Optionalize } from "../deps.ts"; export function transformWebhook(bot: Bot, payload: DiscordWebhook) { const webhook = { diff --git a/transformers/welcomeScreen.ts b/plugins/bot/transformers/welcomeScreen.ts similarity index 85% rename from transformers/welcomeScreen.ts rename to plugins/bot/transformers/welcomeScreen.ts index 06b9fb9c2..23f8aa370 100644 --- a/transformers/welcomeScreen.ts +++ b/plugins/bot/transformers/welcomeScreen.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordWelcomeScreen } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordWelcomeScreen, Optionalize } from "../deps.ts"; export function transformWelcomeScreen(bot: Bot, payload: DiscordWelcomeScreen) { const welcomeScreen = { diff --git a/transformers/widget.ts b/plugins/bot/transformers/widget.ts similarity index 89% rename from transformers/widget.ts rename to plugins/bot/transformers/widget.ts index a77960bdc..db631df6a 100644 --- a/transformers/widget.ts +++ b/plugins/bot/transformers/widget.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordGuildWidget } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordGuildWidget, Optionalize } from "../deps.ts"; export function transformWidget(bot: Bot, payload: DiscordGuildWidget) { const widget = { diff --git a/transformers/widgetSettings.ts b/plugins/bot/transformers/widgetSettings.ts similarity index 75% rename from transformers/widgetSettings.ts rename to plugins/bot/transformers/widgetSettings.ts index 2754e00c2..1dba70f65 100644 --- a/transformers/widgetSettings.ts +++ b/plugins/bot/transformers/widgetSettings.ts @@ -1,6 +1,5 @@ import { Bot } from "../bot.ts"; -import { DiscordGuildWidgetSettings } from "../types/discord.ts"; -import { Optionalize } from "../types/shared.ts"; +import { DiscordGuildWidgetSettings, Optionalize } from "../deps.ts"; export function transformWidgetSettings(bot: Bot, payload: DiscordGuildWidgetSettings) { const widget = { diff --git a/types/discordeno.ts b/plugins/bot/typings.ts similarity index 96% rename from types/discordeno.ts rename to plugins/bot/typings.ts index 48ec45b74..004ce64af 100644 --- a/types/discordeno.ts +++ b/plugins/bot/typings.ts @@ -1,4 +1,4 @@ -import { AllowedMentionsTypes, ButtonStyles, MessageComponentTypes, TextStyles } from "./shared.ts"; +import { AllowedMentionsTypes, ButtonStyles, MessageComponentTypes, TextStyles } from "./deps.ts"; export type MessageComponents = ActionRow[]; @@ -111,13 +111,6 @@ export interface AllowedMentions { users?: bigint[]; } -export interface FileContent { - /** The file blob */ - blob: Blob; - /** The name of the file */ - name: string; -} - /** https://discord.com/developers/docs/resources/guild#search-guild-members-query-string-params */ export interface SearchMembers { /** Query string to match username(s) and nickname(s) against */ diff --git a/util/bigint.ts b/plugins/bot/util/bigint.ts similarity index 100% rename from util/bigint.ts rename to plugins/bot/util/bigint.ts diff --git a/plugins/bot/util/collection.ts b/plugins/bot/util/collection.ts new file mode 100644 index 000000000..cd2934157 --- /dev/null +++ b/plugins/bot/util/collection.ts @@ -0,0 +1,149 @@ +import { Bot } from "../bot.ts"; + +export class BotCollection extends Map { + maxSize: number | undefined; + sweeper: BotCollectionSweeper & { intervalId?: number } | undefined; + + constructor(entries?: (readonly (readonly [K, V])[] | null) | Map, options?: BotCollectionOptions) { + super(entries ?? []); + + this.maxSize = options?.maxSize; + + if (!options?.sweeper) return; + + this.startSweeper(options.sweeper); + } + + startSweeper(options: BotCollectionSweeper): number { + if (this.sweeper?.intervalId) clearInterval(this.sweeper.intervalId); + + this.sweeper = options; + this.sweeper.intervalId = setInterval(() => { + this.forEach((value, key) => { + if (!this.sweeper?.filter(value, key, options.bot)) return; + + this.delete(key); + return key; + }); + }, options.interval); + + return this.sweeper.intervalId!; + } + + stopSweeper(): void { + return clearInterval(this.sweeper?.intervalId); + } + + changeSweeperInterval(newInterval: number) { + if (!this.sweeper) return; + + this.startSweeper({ filter: this.sweeper.filter, interval: newInterval }); + } + + changeSweeperFilter(newFilter: (value: V, key: K, bot: Bot) => boolean) { + if (!this.sweeper) return; + + this.startSweeper({ filter: newFilter, interval: this.sweeper.interval }); + } + + set(key: K, value: V) { + // When this collection is maxSized make sure we can add first + if ((this.maxSize || this.maxSize === 0) && this.size >= this.maxSize) { + return this; + } + + return super.set(key, value); + } + + forceSet(key: K, value: V) { + return super.set(key, value); + } + + array() { + return [...this.values()]; + } + + /** Retrieve the value of the first element in this collection */ + first(): V | undefined { + return this.values().next().value; + } + + last(): V | undefined { + return [...this.values()][this.size - 1]; + } + + random(): V | undefined { + const array = [...this.values()]; + return array[Math.floor(Math.random() * array.length)]; + } + + find(callback: (value: V, key: K) => boolean) { + for (const key of this.keys()) { + const value = this.get(key)!; + if (callback(value, key)) return value; + } + // If nothing matched + return; + } + + filter(callback: (value: V, key: K) => boolean) { + const relevant = new BotCollection(); + this.forEach((value, key) => { + if (callback(value, key)) relevant.set(key, value); + }); + + return relevant; + } + + map(callback: (value: V, key: K) => T) { + const results = []; + for (const key of this.keys()) { + const value = this.get(key)!; + results.push(callback(value, key)); + } + return results; + } + + some(callback: (value: V, key: K) => boolean) { + for (const key of this.keys()) { + const value = this.get(key)!; + if (callback(value, key)) return true; + } + + return false; + } + + every(callback: (value: V, key: K) => boolean) { + for (const key of this.keys()) { + const value = this.get(key)!; + if (!callback(value, key)) return false; + } + + return true; + } + + reduce(callback: (accumulator: T, value: V, key: K) => T, initialValue?: T): T { + let accumulator: T = initialValue!; + + for (const key of this.keys()) { + const value = this.get(key)!; + accumulator = callback(accumulator, value, key); + } + + return accumulator; + } +} + +export interface BotCollectionOptions { + sweeper?: BotCollectionSweeper; + maxSize?: number; +} + +export interface BotCollectionSweeper { + /** The filter to determine whether an element should be deleted or not */ + filter: (value: V, key: K, ...args: any[]) => boolean; + /** The interval in which the sweeper should run */ + interval: number; + /** The bot object itself */ + bot?: Bot; +} diff --git a/util/hash.ts b/plugins/bot/util/hash.ts similarity index 100% rename from util/hash.ts rename to plugins/bot/util/hash.ts diff --git a/plugins/bot/util/mod.ts b/plugins/bot/util/mod.ts new file mode 100644 index 000000000..14d9f9c1c --- /dev/null +++ b/plugins/bot/util/mod.ts @@ -0,0 +1,8 @@ +export * from "./bigint.ts"; +export * from "./collection.ts"; +export * from "./hash.ts"; +export * from "./permissions.ts"; +export * from "./routes.ts"; +export * from "./urlToBase64.ts"; +export * from "./utils.ts"; +export * from "./validateLength.ts"; diff --git a/util/permissions.ts b/plugins/bot/util/permissions.ts similarity index 91% rename from util/permissions.ts rename to plugins/bot/util/permissions.ts index 1386eaf11..9a2198c1c 100644 --- a/util/permissions.ts +++ b/plugins/bot/util/permissions.ts @@ -1,4 +1,4 @@ -import { BitwisePermissionFlags, PermissionStrings } from "../types/shared.ts"; +import { BitwisePermissionFlags, PermissionStrings } from "../deps.ts"; /** This function converts a bitwise string to permission strings */ export function calculatePermissions(permissionBits: bigint) { diff --git a/util/routes.ts b/plugins/bot/util/routes.ts similarity index 99% rename from util/routes.ts rename to plugins/bot/util/routes.ts index b5a4c3ac7..7b0ae66a1 100644 --- a/util/routes.ts +++ b/plugins/bot/util/routes.ts @@ -1,3 +1,4 @@ +import { baseEndpoints } from "../deps.ts"; import { ListArchivedThreads } from "../helpers/channels/threads/getArchivedThreads.ts"; import { GetGuildAuditLog } from "../helpers/guilds/getAuditLogs.ts"; import { GetBans } from "../helpers/guilds/getBans.ts"; @@ -13,7 +14,6 @@ import { isGetMessagesLimit, } from "../helpers/messages/getMessages.ts"; import { GetReactions } from "../helpers/messages/getReactions.ts"; -import { baseEndpoints } from "./constants.ts"; export const routes = { GATEWAY_BOT: () => { diff --git a/util/urlToBase64.ts b/plugins/bot/util/urlToBase64.ts similarity index 100% rename from util/urlToBase64.ts rename to plugins/bot/util/urlToBase64.ts diff --git a/util/utils.ts b/plugins/bot/util/utils.ts similarity index 76% rename from util/utils.ts rename to plugins/bot/util/utils.ts index e4c6339f3..02716d0cf 100644 --- a/util/utils.ts +++ b/plugins/bot/util/utils.ts @@ -1,14 +1,5 @@ import { ImageFormat, ImageSize } from "../helpers/members/avatarUrl.ts"; -/** Pause the execution for a given amount of milliseconds. */ -export function delay(ms: number): Promise { - return new Promise((res): number => - setTimeout((): void => { - res(); - }, ms) - ); -} - /** Help format an image url. */ export function formatImageURL(url: string, size: ImageSize = 128, format?: ImageFormat) { return `${url}.${format || (url.includes("/a_") ? "gif" : "jpg")}?size=${size}`; diff --git a/util/validateLength.ts b/plugins/bot/util/validateLength.ts similarity index 100% rename from util/validateLength.ts rename to plugins/bot/util/validateLength.ts diff --git a/rest/createRequestBody.ts b/rest/createRequestBody.ts index 97855debd..9781c7a63 100644 --- a/rest/createRequestBody.ts +++ b/rest/createRequestBody.ts @@ -1,5 +1,5 @@ import { RestManager } from "./restManager.ts"; -import { FileContent } from "../types/discordeno.ts"; +import { FileContent } from "../types/shared.ts"; import { USER_AGENT } from "../util/constants.ts"; import { RequestMethod, RestPayload, RestRequest } from "./rest.ts"; diff --git a/rest/runMethod.ts b/rest/runMethod.ts index f1c3d18e5..b7ea8fd02 100644 --- a/rest/runMethod.ts +++ b/rest/runMethod.ts @@ -43,8 +43,10 @@ export async function runMethod( }); if (!result.ok) { - errorStack.message = result.statusText as Error["message"]; - console.error(`Error: ${errorStack.message}`); + errorStack.message = result.statusText; + rest.debug(`[ERROR] ${errorStack.message}`); + // Closes the response to prevent memory leak + await result.text(); throw errorStack; } diff --git a/tests/channels/deleteWithReason.test.ts b/tests/channels/deleteWithReason.test.ts index 8f56ced12..f961ae81d 100644 --- a/tests/channels/deleteWithReason.test.ts +++ b/tests/channels/deleteWithReason.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../deps.ts"; +import { assertExists, assertRejects } from "../deps.ts"; import { loadBot } from "../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts"; @@ -17,7 +17,8 @@ Deno.test({ await bot.helpers.deleteChannel(channel.id, "with a reason"); // Check if channel still exists - const exists = await bot.helpers.getChannel(channel.id); - assertEquals(exists, undefined); + await assertRejects( + () => bot.helpers.getChannel(channel.id), + ); }, }); diff --git a/tests/channels/deleteWithoutReason.test.ts b/tests/channels/deleteWithoutReason.test.ts index 9295dfa4b..595a25eb4 100644 --- a/tests/channels/deleteWithoutReason.test.ts +++ b/tests/channels/deleteWithoutReason.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../deps.ts"; +import { assertEquals, assertExists, assertRejects } from "../deps.ts"; import { loadBot } from "../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts"; @@ -18,7 +18,8 @@ Deno.test({ await bot.helpers.deleteChannel(channel.id); // Check if channel still exists - const exists = await bot.helpers.getChannel(channel.id); - assertEquals(exists, undefined); + await assertRejects( + () => bot.helpers.getChannel(channel.id), + ); }, }); diff --git a/tests/channels/messages/message.test.ts b/tests/channels/messages/message.test.ts index 20f5e3825..4263ec206 100644 --- a/tests/channels/messages/message.test.ts +++ b/tests/channels/messages/message.test.ts @@ -1,5 +1,5 @@ import { ButtonStyles, ChannelTypes, delay, MessageComponentTypes } from "../../../mod.ts"; -import { assertEquals, assertExists, assertNotEquals } from "../../deps.ts"; +import { assertEquals, assertExists, assertNotEquals, assertRejects } from "../../deps.ts"; import { loadBot } from "../../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../../utils.ts"; @@ -167,8 +167,7 @@ Deno.test({ assertEquals(message.content, "Hello Skillz"); await bot.helpers.deleteMessage(channel.id, message.id, "Test"); - const deletedMessage = await bot.helpers.getMessage(channel.id, message.id); - assertEquals(deletedMessage, undefined); + await assertRejects(() => bot.helpers.getMessage(channel.id, message.id)); }); // Delete the message without a reason @@ -180,8 +179,7 @@ Deno.test({ assertEquals(message.content, "Hello Skillz"); await bot.helpers.deleteMessage(channel.id, message.id); - const deletedMessage = await bot.helpers.getMessage(channel.id, message.id); - assertEquals(deletedMessage, undefined); + await assertRejects(() => bot.helpers.getMessage(channel.id, message.id)); }); // Bulk delete messages with a reason @@ -199,10 +197,8 @@ Deno.test({ assertEquals(message2.content, "Hello Skillz 2"); await bot.helpers.deleteMessages(channel.id, [message1.id, message2.id], "Test"); - const deletedMessage1 = await bot.helpers.getMessage(channel.id, message1.id); - assertEquals(deletedMessage1, undefined); - const deletedMessage2 = await bot.helpers.getMessage(channel.id, message2.id); - assertEquals(deletedMessage2, undefined); + await assertRejects(() => bot.helpers.getMessage(channel.id, message1.id)); + await assertRejects(() => bot.helpers.getMessage(channel.id, message2.id)); }); // Bulk delete messages without a reason @@ -221,10 +217,8 @@ Deno.test({ await bot.helpers.deleteMessages(channel.id, [message1.id, message2.id]); await delay(3000); - const deletedMessage1 = await bot.helpers.getMessage(channel.id, message1.id); - assertEquals(deletedMessage1, undefined); - const deletedMessage2 = await bot.helpers.getMessage(channel.id, message2.id); - assertEquals(deletedMessage2, undefined); + await assertRejects(() => bot.helpers.getMessage(channel.id, message1.id)); + await assertRejects(() => bot.helpers.getMessage(channel.id, message2.id)); }); // Get a message diff --git a/tests/guilds/events/events.test.ts b/tests/guilds/events/events.test.ts index 57969fb6a..842b76494 100644 --- a/tests/guilds/events/events.test.ts +++ b/tests/guilds/events/events.test.ts @@ -1,5 +1,5 @@ import { ChannelTypes, ScheduledEventEntityType, ScheduledEventPrivacyLevel } from "../../../mod.ts"; -import { assertEquals, assertExists } from "../../deps.ts"; +import { assertEquals, assertExists, assertRejects } from "../../deps.ts"; import { loadBot } from "../../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../../utils.ts"; @@ -179,8 +179,9 @@ Deno.test({ "[scheduled event] delete the guild scheduled event.", async () => { await bot.helpers.deleteScheduledEvent(CACHED_COMMUNITY_GUILD_ID, event.id); - const fetchedEvent = await bot.helpers.getScheduledEvent(CACHED_COMMUNITY_GUILD_ID, event.id); - assertEquals(fetchedEvent, undefined); + await assertRejects( + () => bot.helpers.getScheduledEvent(CACHED_COMMUNITY_GUILD_ID, event.id), + ); }, ); diff --git a/tests/guilds/guild.test.ts b/tests/guilds/guild.test.ts index 226d880b4..e46809b4c 100644 --- a/tests/guilds/guild.test.ts +++ b/tests/guilds/guild.test.ts @@ -1,14 +1,11 @@ import { ChannelTypes } from "../../mod.ts"; -import { assertEquals, assertExists, assertNotEquals } from "../deps.ts"; +import { assertEquals, assertExists, assertNotEquals, assertRejects } from "../deps.ts"; import { loadBot } from "../mod.ts"; Deno.test({ name: "[guild] Create a guild", async fn(t) { const bot = loadBot(); - - // Delete the oldest guild(most likely to have finished tests). - const guild = await bot.helpers.createGuild({ name: "Discordeno-test", }); @@ -88,8 +85,7 @@ Deno.test({ // Get vanity URL await t.step("[guild] Get vanity URL", async () => { - const vanityUrl = await bot.helpers.getVanityUrl(guild.id); - assertEquals(vanityUrl.code, undefined); + await assertRejects(() => bot.helpers.getVanityUrl(guild.id)); }); // Emoji related tests @@ -128,8 +124,9 @@ Deno.test({ await bot.helpers.deleteEmoji(guild.id, emoji.id); - const exists = await bot.helpers.getEmoji(guild.id, emoji.id); - assertEquals(exists.id, undefined); + await assertRejects( + () => bot.helpers.getEmoji(guild.id, emoji.id!), + ); }, }); @@ -149,8 +146,9 @@ Deno.test({ await bot.helpers.deleteEmoji(guild.id, emoji.id, "with a reason"); - const exists = await bot.helpers.getEmoji(guild.id, emoji.id); - assertEquals(exists.id, undefined); + await assertRejects( + () => bot.helpers.getEmoji(guild.id, emoji.id!), + ); }, }); @@ -265,9 +263,10 @@ Deno.test({ // Delete a guild await t.step("[guild] Delete a guild", async () => { await bot.helpers.deleteGuild(guild.id); - // - const exists = await bot.helpers.getGuild(guild.id); - assertEquals(exists, undefined); + + await assertRejects( + () => bot.helpers.getGuild(guild.id), + ); }); } catch (error) { // If any errors arise, delete the guild diff --git a/tests/guilds/members/bans.test.ts b/tests/guilds/members/bans.test.ts index 2decad742..e7aa87170 100644 --- a/tests/guilds/members/bans.test.ts +++ b/tests/guilds/members/bans.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../../deps.ts"; +import { assertEquals, assertExists, assertRejects } from "../../deps.ts"; import { loadBot } from "../../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../../utils.ts"; @@ -66,7 +66,9 @@ Deno.test({ bot.helpers.unbanMember(CACHED_COMMUNITY_GUILD_ID, ianID), ]); - assertEquals(await bot.helpers.getBan(CACHED_COMMUNITY_GUILD_ID, wolfID), undefined); + await assertRejects( + () => bot.helpers.getBan(CACHED_COMMUNITY_GUILD_ID, wolfID), + ); }, }); }, diff --git a/tests/mod.ts b/tests/mod.ts index 12827381a..a0151d535 100644 --- a/tests/mod.ts +++ b/tests/mod.ts @@ -1,4 +1,4 @@ -import { createBot, createRestManager, runMethod } from "../mod.ts"; +import { createBot, createRestManager } from "../plugins/bot/mod.ts"; import { dotenv } from "./deps.ts"; dotenv({ export: true, path: `${Deno.cwd()}/.env` }); diff --git a/tests/rest.ts b/tests/rest.ts index 301846ed5..306b7fa46 100644 --- a/tests/rest.ts +++ b/tests/rest.ts @@ -87,8 +87,9 @@ async function handleRequest(conn: Deno.Conn) { error.code, error, ); + requestEvent.respondWith( - new Response(JSON.stringify(error), { + new Response(error.message, { status: error.code ?? 469, }), ); diff --git a/tests/utils.test.ts b/tests/utils.test.ts index a4aaea2dd..cb6b1a5ce 100644 --- a/tests/utils.test.ts +++ b/tests/utils.test.ts @@ -1,6 +1,13 @@ -import { formatImageURL, hasProperty, iconBigintToHash, iconHashToBigInt, validateLength } from "../mod.ts"; -import { bigintToSnowflake, snowflakeToBigint } from "../util/bigint.ts"; -import { removeTokenPrefix } from "../util/token.ts"; +import { + bigintToSnowflake, + formatImageURL, + hasProperty, + iconBigintToHash, + iconHashToBigInt, + removeTokenPrefix, + snowflakeToBigint, + validateLength, +} from "../plugins/bot/mod.ts"; import { assertEquals, assertNotEquals } from "./deps.ts"; import { loadBot } from "./mod.ts"; diff --git a/tests/webhook/deleteWebhook.test.ts b/tests/webhook/deleteWebhook.test.ts index c8ad9029f..75a399c3a 100644 --- a/tests/webhook/deleteWebhook.test.ts +++ b/tests/webhook/deleteWebhook.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../deps.ts"; +import { assertEquals, assertExists, assertRejects } from "../deps.ts"; import { loadBot } from "../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts"; @@ -16,9 +16,9 @@ Deno.test({ await bot.helpers.deleteWebhook(webhook.id); // Fetch the webhook to validate it was deleted - const deletedWebhook = await bot.helpers.getWebhook(webhook.id); - - assertEquals(deletedWebhook, undefined); + await assertRejects( + () => bot.helpers.getWebhook(webhook.id), + ); await bot.helpers.deleteChannel(channel.id); }, diff --git a/tests/webhook/deleteWebhookWithToken.test.ts b/tests/webhook/deleteWebhookWithToken.test.ts index 2554d5e60..cea284791 100644 --- a/tests/webhook/deleteWebhookWithToken.test.ts +++ b/tests/webhook/deleteWebhookWithToken.test.ts @@ -1,4 +1,4 @@ -import { assertEquals, assertExists } from "../deps.ts"; +import { assertEquals, assertExists, assertRejects } from "../deps.ts"; import { loadBot } from "../mod.ts"; import { CACHED_COMMUNITY_GUILD_ID } from "../utils.ts"; @@ -17,9 +17,9 @@ Deno.test({ await bot.helpers.deleteWebhookWithToken(webhook.id, webhook.token); // Fetch the webhook to validate it was deleted - const deletedWebhook = await bot.helpers.getWebhook(webhook.id); - - assertEquals(deletedWebhook, undefined); + await assertRejects( + () => bot.helpers.getWebhook(webhook.id), + ); await bot.helpers.deleteChannel(channel.id); }, diff --git a/types/discord.ts b/types/discord.ts index 47b85414b..37cd84c49 100644 --- a/types/discord.ts +++ b/types/discord.ts @@ -768,6 +768,13 @@ export interface DiscordPresenceUpdate { client_status: DiscordClientStatus; } +export interface DiscordStatusUpdate { + /** User's current activities */ + activities: DiscordActivity[]; + /** Either "idle", "dnd", "online", or "offline" */ + status: "idle" | "dnd" | "online" | "offline"; +} + /** https://discord.com/developers/docs/resources/guild#welcome-screen-object-welcome-screen-structure */ export interface DiscordWelcomeScreen { /** The server description shown in the welcome screen */ diff --git a/types/mod.ts b/types/mod.ts index 92e59dd47..1ef8f1ddd 100644 --- a/types/mod.ts +++ b/types/mod.ts @@ -1,3 +1,2 @@ export * from "./discord.ts"; -export * from "./discordeno.ts"; export * from "./shared.ts"; diff --git a/types/shared.ts b/types/shared.ts index 37846069a..500118819 100644 --- a/types/shared.ts +++ b/types/shared.ts @@ -1201,6 +1201,31 @@ export enum Locales { export type Localization = Partial>; +export interface FileContent { + /** The file blob */ + blob: Blob; + /** The name of the file */ + name: string; +} + +export interface GatewayBot { + /** The WSS URL that can be used for connecting to the gateway */ + url: string; + /** The recommended number of shards to use when connecting */ + shards: number; + /** Information on the current session start limit */ + sessionStartLimit: { + /** The total number of session starts the current user is allowed */ + total: number; + /** The remaining number of session starts the current user is allowed */ + remaining: number; + /** The number of milliseconds after which the limit resets */ + resetAfter: number; + /** The number of identify requests allowed per 5 seconds */ + maxConcurrency: number; + }; +} + // UTILS export type AtLeastOne }> = Partial & U[keyof U]; diff --git a/util/bucket.ts b/util/bucket.ts index 5429c4416..d9683525b 100644 --- a/util/bucket.ts +++ b/util/bucket.ts @@ -1,5 +1,5 @@ import { PickPartial } from "../types/shared.ts"; -import { delay } from "./utils.ts"; +import { delay } from "./delay.ts"; /** A Leaky Bucket. * Useful for rate limiting purposes. diff --git a/util/collection.ts b/util/collection.ts index 2d53e101a..3d161c64c 100644 --- a/util/collection.ts +++ b/util/collection.ts @@ -1,49 +1,10 @@ -import { Bot } from "../bot.ts"; - export class Collection extends Map { maxSize: number | undefined; - sweeper: CollectionSweeper & { intervalId?: number } | undefined; constructor(entries?: (readonly (readonly [K, V])[] | null) | Map, options?: CollectionOptions) { super(entries ?? []); this.maxSize = options?.maxSize; - - if (!options?.sweeper) return; - - this.startSweeper(options.sweeper); - } - - startSweeper(options: CollectionSweeper): number { - if (this.sweeper?.intervalId) clearInterval(this.sweeper.intervalId); - - this.sweeper = options; - this.sweeper.intervalId = setInterval(() => { - this.forEach((value, key) => { - if (!this.sweeper?.filter(value, key, options.bot)) return; - - this.delete(key); - return key; - }); - }, options.interval); - - return this.sweeper.intervalId!; - } - - stopSweeper(): void { - return clearInterval(this.sweeper?.intervalId); - } - - changeSweeperInterval(newInterval: number) { - if (!this.sweeper) return; - - this.startSweeper({ filter: this.sweeper.filter, interval: newInterval }); - } - - changeSweeperFilter(newFilter: (value: V, key: K, bot: Bot) => boolean) { - if (!this.sweeper) return; - - this.startSweeper({ filter: newFilter, interval: this.sweeper.interval }); } set(key: K, value: V) { @@ -135,15 +96,5 @@ export class Collection extends Map { } export interface CollectionOptions { - sweeper?: CollectionSweeper; maxSize?: number; } - -export interface CollectionSweeper { - /** The filter to determine whether an element should be deleted or not */ - filter: (value: V, key: K, ...args: any[]) => boolean; - /** The interval in which the sweeper should run */ - interval: number; - /** The bot object itself */ - bot?: Bot; -} diff --git a/util/delay.ts b/util/delay.ts new file mode 100644 index 000000000..19f288203 --- /dev/null +++ b/util/delay.ts @@ -0,0 +1,8 @@ +/** Pause the execution for a given amount of milliseconds. */ +export function delay(ms: number): Promise { + return new Promise((res): number => + setTimeout((): void => { + res(); + }, ms) + ); +} diff --git a/util/mod.ts b/util/mod.ts index 13f0b85db..89115b018 100644 --- a/util/mod.ts +++ b/util/mod.ts @@ -1,7 +1,5 @@ -export * from "./bigint.ts"; -export * from "./calculateShardId.ts"; +export * from "./bucket.ts"; export * from "./collection.ts"; export * from "./constants.ts"; -export * from "./hash.ts"; -export * from "./utils.ts"; -export * from "./validateLength.ts"; +export * from "./delay.ts"; +export * from "./token.ts";