├── .circleci └── config.yml ├── .dockerignore ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── Dockerfile ├── README.md ├── bl-compose ├── .env-sample ├── README.md ├── build-all-images.sh ├── build-image-backend.sh ├── build-image-base.sh ├── build-image-frontend.sh ├── docker-compose.yml └── run-only-frontend.sh ├── book ├── .gitignore ├── book.toml └── src │ ├── SUMMARY.md │ ├── commands.md │ ├── images │ └── components-sample.png │ ├── interactions.md │ ├── interactions_components.md │ ├── interactions_handling.md │ ├── interactions_modals.md │ ├── interactions_state.md │ ├── interval_timers.md │ ├── introduction.md │ ├── message_user_commands.md │ ├── scheduled_tasks.md │ ├── script_lifecycle.md │ ├── script_management.md │ ├── script_management_vscode.md │ ├── script_management_web.md │ ├── settings.md │ ├── settings_changes.md │ ├── settings_list.md │ ├── slash_commands.md │ ├── storage.md │ ├── timers.md │ └── tutorial_echo.md ├── botloader-vscode ├── .dockerignore ├── .eslintrc.json ├── .gitignore ├── .vscodeignore ├── LICENSE.txt ├── README.md ├── package-lock.json ├── package.json ├── src │ ├── extension.ts │ ├── guildspace.ts │ ├── models.ts │ ├── test │ │ ├── runTest.ts │ │ └── suite │ │ │ ├── extension.test.ts │ │ │ └── index.ts │ ├── util.ts │ ├── workspacemanager.ts │ └── ws.ts ├── tsconfig.json └── vsc-extension-quickstart.md ├── build-frontend-with-docs.sh ├── cmd ├── backend │ ├── Cargo.toml │ ├── Dockerfile │ └── src │ │ └── main.rs ├── blcmd │ ├── Cargo.toml │ └── src │ │ ├── api_client.rs │ │ └── main.rs ├── dbmigrations │ └── Dockerfile ├── dbserver │ ├── Cargo.toml │ ├── Dockerfile │ └── src │ │ └── main.rs └── prepare-integration-tests │ ├── Cargo.toml │ └── src │ └── main.rs ├── components ├── axum-metrics-layer │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── botrpc │ ├── Cargo.toml │ ├── README.md │ ├── build.rs │ ├── proto │ │ └── botrpc.proto │ └── src │ │ ├── client.rs │ │ ├── lib.rs │ │ └── proto.rs ├── common │ ├── Cargo.toml │ └── src │ │ ├── config.rs │ │ ├── discord.rs │ │ ├── dispatch_event.rs │ │ ├── lib.rs │ │ ├── plugin.rs │ │ ├── shutdown.rs │ │ └── user.rs ├── dbrokerapi │ ├── Cargo.toml │ └── src │ │ ├── broker_scheduler_rpc.rs │ │ ├── lib.rs │ │ ├── models │ │ ├── guild.rs │ │ ├── member.rs │ │ └── mod.rs │ │ └── state_client.rs ├── discordbroker │ ├── Cargo.toml │ ├── Dockerfile │ └── src │ │ ├── broker.rs │ │ ├── dispatch_server.rs │ │ ├── http_api.rs │ │ └── lib.rs ├── discordoauthwrapper │ ├── Cargo.toml │ └── src │ │ ├── cache.rs │ │ ├── lib.rs │ │ └── twilight_api_provider.rs ├── guild-logger │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── discord_backend.rs │ │ ├── entry.rs │ │ ├── guild_subscriber_backend.rs │ │ └── lib.rs ├── jobs │ ├── Cargo.toml │ └── src │ │ ├── job.rs │ │ ├── left_guilds.rs │ │ ├── lib.rs │ │ └── plugin_stats.rs ├── runtime-models │ ├── Cargo.toml │ ├── gen-index.bash │ ├── gen-move-types.bash │ └── src │ │ ├── discord │ │ ├── channel.rs │ │ ├── component.rs │ │ ├── embed.rs │ │ ├── events.rs │ │ ├── guild.rs │ │ ├── invite.rs │ │ ├── member.rs │ │ ├── message.rs │ │ ├── mod.rs │ │ ├── role.rs │ │ └── util.rs │ │ ├── image.rs │ │ ├── internal │ │ ├── channel.rs │ │ ├── components.rs │ │ ├── console.rs │ │ ├── emoji.rs │ │ ├── events.rs │ │ ├── httpclient.rs │ │ ├── interaction.rs │ │ ├── interactions.rs │ │ ├── invite.rs │ │ ├── member.rs │ │ ├── messages.rs │ │ ├── misc_op.rs │ │ ├── mod.rs │ │ ├── role.rs │ │ ├── script.rs │ │ ├── storage.rs │ │ ├── tasks.rs │ │ ├── timers.rs │ │ ├── user.rs │ │ └── webhook.rs │ │ ├── lib.rs │ │ ├── ops.rs │ │ └── util.rs ├── runtime │ ├── Cargo.toml │ ├── build.rs │ ├── docgen │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package-lock.json │ │ ├── package.json │ │ └── src │ │ │ ├── README.md │ │ │ └── index.js │ └── src │ │ ├── extensions │ │ ├── base64.rs │ │ ├── console.rs │ │ ├── discord.rs │ │ ├── httpclient.rs │ │ ├── image.rs │ │ ├── mod.rs │ │ ├── storage.rs │ │ └── tasks.rs │ │ ├── jsmodules.rs │ │ ├── lib.rs │ │ ├── limits.rs │ │ └── ts │ │ ├── .swcrc │ │ ├── build-types-copy-frontend.sh │ │ ├── commands.ts │ │ ├── core_util.ts │ │ ├── discord │ │ ├── channel.ts │ │ ├── common.ts │ │ ├── components.ts │ │ ├── dapi.ts │ │ ├── emoji.ts │ │ ├── error.ts │ │ ├── events.ts │ │ ├── index.ts │ │ ├── interaction.ts │ │ ├── invite.ts │ │ ├── member.ts │ │ ├── message.ts │ │ ├── permissions.ts │ │ ├── snowflake.ts │ │ ├── user.ts │ │ └── webhook.ts │ │ ├── docs_index.ts │ │ ├── eventsystem.ts │ │ ├── generated │ │ ├── discord │ │ │ ├── Attachment.ts │ │ │ ├── AuditLogExtras.ts │ │ │ ├── ButtonStyle.ts │ │ │ ├── ChannelMention.ts │ │ │ ├── ChannelType.ts │ │ │ ├── ComponentType.ts │ │ │ ├── DefaultMessageNotificationLevel.ts │ │ │ ├── Embed.ts │ │ │ ├── EmbedAuthor.ts │ │ │ ├── EmbedField.ts │ │ │ ├── EmbedFooter.ts │ │ │ ├── EmbedImage.ts │ │ │ ├── EmbedProvider.ts │ │ │ ├── EmbedThumbnail.ts │ │ │ ├── EmbedVideo.ts │ │ │ ├── EventMessageDelete.ts │ │ │ ├── EventMessageReactionRemove.ts │ │ │ ├── EventMessageReactionRemoveAll.ts │ │ │ ├── EventMessageReactionRemoveAllEmoji.ts │ │ │ ├── EventRoleDelete.ts │ │ │ ├── ExplicitContentFilter.ts │ │ │ ├── Guild.ts │ │ │ ├── IActionRow.ts │ │ │ ├── IButton.ts │ │ │ ├── IComponent.ts │ │ │ ├── IEventThreadDelete.ts │ │ │ ├── IInviteChannel.ts │ │ │ ├── IInviteGuild.ts │ │ │ ├── IInviteTargetUser.ts │ │ │ ├── IPermissionOverwrite.ts │ │ │ ├── ISelectMenu.ts │ │ │ ├── ISelectMenuOption.ts │ │ │ ├── ITextInput.ts │ │ │ ├── IUnknownComponent.ts │ │ │ ├── InviteTargetType.ts │ │ │ ├── MessageActivity.ts │ │ │ ├── MessageActivityType.ts │ │ │ ├── MessageApplication.ts │ │ │ ├── MessageFlags.ts │ │ │ ├── MessageReaction.ts │ │ │ ├── MessageReference.ts │ │ │ ├── MessageType.ts │ │ │ ├── MfaLevel.ts │ │ │ ├── NsfwLevel.ts │ │ │ ├── PartialMember.ts │ │ │ ├── PermissionOverwriteType.ts │ │ │ ├── PremiumTier.ts │ │ │ ├── ReactionType.ts │ │ │ ├── Role.ts │ │ │ ├── RoleTags.ts │ │ │ ├── SelectDefaultValue.ts │ │ │ ├── SelectMenuType.ts │ │ │ ├── SendEmoji.ts │ │ │ ├── SystemChannelFlags.ts │ │ │ ├── TextInputStyle.ts │ │ │ ├── ThreadMetadata.ts │ │ │ ├── VerificationLevel.ts │ │ │ ├── VideoQualityMode.ts │ │ │ └── index.ts │ │ ├── image │ │ │ ├── SupportedEncodeImageFormat.ts │ │ │ ├── SupportedImageFormat.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ └── internal │ │ │ ├── AllowedMentions.ts │ │ │ ├── AutocompleteCallbackData.ts │ │ │ ├── Ban.ts │ │ │ ├── CategoryChannel.ts │ │ │ ├── ClientHttpRequest.ts │ │ │ ├── ClientHttpResponse.ts │ │ │ ├── Command.ts │ │ │ ├── CommandGroup.ts │ │ │ ├── CommandInteraction.ts │ │ │ ├── CommandInteractionOption.ts │ │ │ ├── CommandInteractionOptionValue.ts │ │ │ ├── CommandOption.ts │ │ │ ├── CommandOptionChoice.ts │ │ │ ├── CommandOptionChoiceValue.ts │ │ │ ├── CommandOptionType.ts │ │ │ ├── CommandSubGroup.ts │ │ │ ├── CommandType.ts │ │ │ ├── ConsoleLogLevel.ts │ │ │ ├── ConsoleLogMessage.ts │ │ │ ├── CreateBanFields.ts │ │ │ ├── CreateChannelMessage.ts │ │ │ ├── CreateFollowUpMessage.ts │ │ │ ├── CreateMessageFields.ts │ │ │ ├── CreateRoleFields.ts │ │ │ ├── CreateScheduledTask.ts │ │ │ ├── CustomEmoji.ts │ │ │ ├── DeleteMessage.ts │ │ │ ├── DeleteMessagesBulk.ts │ │ │ ├── DiscordWebhook.ts │ │ │ ├── EasyOpsASync.ts │ │ │ ├── EasyOpsReturnTypesASync.ts │ │ │ ├── EditChannel.ts │ │ │ ├── EditChannelMessage.ts │ │ │ ├── EventMemberRemove.ts │ │ │ ├── EventMessageReactionAdd.ts │ │ │ ├── EventMessageUpdate.ts │ │ │ ├── ExtraCommandOptions.ts │ │ │ ├── GetGuildTasksFilter.ts │ │ │ ├── GetMessages.ts │ │ │ ├── GetReactions.ts │ │ │ ├── GuildChannel.ts │ │ │ ├── ICreateChannel.ts │ │ │ ├── ICreateForumThread.ts │ │ │ ├── ICreateInviteFields.ts │ │ │ ├── ICreateThread.ts │ │ │ ├── ICreateThreadFromMessage.ts │ │ │ ├── IEditGuildChannelPosition.ts │ │ │ ├── IEventInviteCreate.ts │ │ │ ├── IEventInviteDelete.ts │ │ │ ├── IEventThreadListSync.ts │ │ │ ├── IEventThreadMembersUpdate.ts │ │ │ ├── IEventVoiceStateUpdate.ts │ │ │ ├── IForumThreadResponse.ts │ │ │ ├── IInvite.ts │ │ │ ├── IListThreadMembersRequest.ts │ │ │ ├── IListThreadsRequest.ts │ │ │ ├── IMessage.ts │ │ │ ├── IModalCallbackData.ts │ │ │ ├── IModalInteraction.ts │ │ │ ├── IModalInteractionDataComponent.ts │ │ │ ├── ISelfThreadMember.ts │ │ │ ├── IThreadsListing.ts │ │ │ ├── IUpdateThread.ts │ │ │ ├── IUser.ts │ │ │ ├── IUserFlags.ts │ │ │ ├── IVoiceState.ts │ │ │ ├── ImageProperties.ts │ │ │ ├── Interaction.ts │ │ │ ├── InteractionCallback.ts │ │ │ ├── InteractionCallbackData.ts │ │ │ ├── InteractionChannel.ts │ │ │ ├── InteractionDataMaps.ts │ │ │ ├── InteractionPartialMember.ts │ │ │ ├── InteractionResponse.ts │ │ │ ├── IntervalTimer.ts │ │ │ ├── IntervalTimerEvent.ts │ │ │ ├── IntervalType.ts │ │ │ ├── Member.ts │ │ │ ├── MentionParseTypes.ts │ │ │ ├── MessageComponentInteraction.ts │ │ │ ├── NewsThread.ts │ │ │ ├── OpCreateEmoji.ts │ │ │ ├── OpCreateMessageAttachment.ts │ │ │ ├── OpCreateWebhook.ts │ │ │ ├── OpEditWebhook.ts │ │ │ ├── OpEditWebhookWithToken.ts │ │ │ ├── OpExecuteWebhook.ts │ │ │ ├── OpUpdateEmoji.ts │ │ │ ├── OpUpdateWebhookMessage.ts │ │ │ ├── OpWebhookMessageSpecifier.ts │ │ │ ├── OpWebhookSpecifier.ts │ │ │ ├── PremiumType.ts │ │ │ ├── PrivateThread.ts │ │ │ ├── PublicThread.ts │ │ │ ├── ScheduledTask.ts │ │ │ ├── ScopeSelector.ts │ │ │ ├── ScriptMeta.ts │ │ │ ├── ScriptTaskBucketId.ts │ │ │ ├── SettingOptionDefinition.ts │ │ │ ├── SettingsNumberSelectOption.ts │ │ │ ├── SettingsOption.ts │ │ │ ├── SettingsOptionList.ts │ │ │ ├── SettingsOptionType.ts │ │ │ ├── SettingsOptionValue.ts │ │ │ ├── SettingsStringSelectOption.ts │ │ │ ├── StorageBucket.ts │ │ │ ├── StorageBucketEntry.ts │ │ │ ├── StorageBucketEntryId.ts │ │ │ ├── StorageBucketIncr.ts │ │ │ ├── StorageBucketList.ts │ │ │ ├── StorageBucketListOrder.ts │ │ │ ├── StorageBucketSetCondition.ts │ │ │ ├── StorageBucketSetIf.ts │ │ │ ├── StorageBucketSetValue.ts │ │ │ ├── StorageBucketSortedList.ts │ │ │ ├── StorageBucketValue.ts │ │ │ ├── TextChannel.ts │ │ │ ├── ThreadMember.ts │ │ │ ├── UnknownChannel.ts │ │ │ ├── UpdateGuildMemberFields.ts │ │ │ ├── UpdateRoleFields.ts │ │ │ ├── UpdateRolePosition.ts │ │ │ ├── UserMention.ts │ │ │ ├── VoiceChannel.ts │ │ │ ├── WebhookChannel.ts │ │ │ ├── WebhookGuild.ts │ │ │ ├── WebhookType.ts │ │ │ └── index.ts │ │ ├── globals │ │ ├── lib.core_util.d.ts │ │ └── script_globals.d.ts │ │ ├── httpclient.ts │ │ ├── image.ts │ │ ├── index.ts │ │ ├── internal_globals │ │ ├── internal-core.d.ts │ │ ├── lib.botloader_core_internal.d.ts │ │ └── lib.deno_core.d.ts │ │ ├── op_wrappers.ts │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── scheduled_tasks.ts │ │ ├── script.ts │ │ ├── settings.ts │ │ ├── storage.ts │ │ ├── tsconfig.json │ │ ├── typedecls.sh │ │ └── unstable │ │ ├── index.ts │ │ └── streams.ts ├── scheduler-worker-rpc │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── scheduler │ ├── Cargo.toml │ └── src │ │ ├── broker_client.rs │ │ ├── command_manager.rs │ │ ├── dispatch_conv.rs │ │ ├── guild_handler.rs │ │ ├── integration_testing.rs │ │ ├── interval_timer_manager.rs │ │ ├── lib.rs │ │ ├── rpc_server.rs │ │ ├── scheduled_task_manager.rs │ │ ├── scheduler.rs │ │ ├── vm_session.rs │ │ ├── vmworkerpool.rs │ │ └── worker_listener.rs ├── simpleproto │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── stores │ ├── .sqlx │ │ ├── query-00d42cb8ca0b04b1d790cfc8e095f125e3038c4e4e2bfeee207d2cb4fc792746.json │ │ ├── query-020ff8ad3794c6bd8072019d166f18606cb7f75cfbabe6407da24a3134d01a82.json │ │ ├── query-0383c9a6c874d971305a6aa4a5d0f2fe2fc7f837d77f93da59117f5c43ee3194.json │ │ ├── query-0878325bad1cf03218fb1e7211b655d9ada6984506ae2d693f9cd4dd07a9dc53.json │ │ ├── query-0cf99a4d9aff437359028cf68e5294debf38acead99c74ea965e9b138983764c.json │ │ ├── query-0d1be72462bf9559ba071f3b07b3d49006abff6585be3aa14b1d8ff1c2dde493.json │ │ ├── query-1132ee84807180e968694967becabbe27a8a2bf738275b93ac7e8c0915e235fc.json │ │ ├── query-125ffa712120b484fd0e40a8bda8953205535bdc81c0c2bef1c97a596cd19a39.json │ │ ├── query-13a15115e1bfa6f1be2596d672a161a9999a049a06f219270bb4cc961c55796e.json │ │ ├── query-13d98ab37ce4072ee51456048094a368a995205dd6b84867677aa1ae4690f12b.json │ │ ├── query-15ceb47518db60042e48a5ce5b07d958cb05343655742628c3720ad730ee4171.json │ │ ├── query-1e3958ca5fddce8eff876a7f3059aa8b9f6f56c131e07109e0a249c46c4235a4.json │ │ ├── query-1e4b5a68f95b2414cd99bbc8948a874a33acd581b6d16a0aaa237acec9896d5c.json │ │ ├── query-22fb66d81e08282063568d3a6abcf305ae3adb02e0212eaca40be8fa3b528818.json │ │ ├── query-25a0eaabe736ebf6e21d8056fc6b5869655f0c0e5f0fcccf90f3703da538a247.json │ │ ├── query-28ba8c9f00ead06d759107bb246a004852ce954301f57e7a54cf54f3d01610ba.json │ │ ├── query-2af7820bad837340a79a4008d4a5de9eca35dfe4928c68e65c59262c1767cde4.json │ │ ├── query-33159918d51423914dc53096f9e698094cf2ce677cf93ec85053ca211cbab848.json │ │ ├── query-34d7d97f33d3cc871cc97cf8fce99fb9b98d46a3417a717b035e5d631c0c7c3b.json │ │ ├── query-37c7c96d21db55b2bb8a79810dea6b0403c80b91a399b57fdc74bbd715a70781.json │ │ ├── query-392452219b0fd10e11dd9ba2e7941b80e76b594f0fe70f644c1ebdf777106c20.json │ │ ├── query-4951c9cb23a3109b04ad512b744c6d4fb442ed242d6813ea646783784c9edabe.json │ │ ├── query-49a6466f558a6f6fd9c3c5fd330502113fabbf0276a0470b6c04ae0fffd551de.json │ │ ├── query-4b20d9c03d1159776838d2af5286ad12df0bc75b71fbf0e9fdabb0bd8aee4750.json │ │ ├── query-4b3a008457563f1277ee8c141216a1c30402348dcddce46c79d51db243b38c20.json │ │ ├── query-4eb880de4c2dea914ffa92fb8c1572e72e344a205166f412dee0ebf590f18dfd.json │ │ ├── query-56c8f5afadce3129b07621c6dd478a18f091bf2b3416032e01b0b9765ab81244.json │ │ ├── query-5a0a17a305b149e8921381797e39e42b542a7a60163164dd52495d64772e8216.json │ │ ├── query-5cdf60ad54854a943e4374c98c596b972f2b1554874767cb23349d123f74d029.json │ │ ├── query-5d0cad2082af1ee21f36f4792c1bf73d601ab58223289e473069dade12bdbdf3.json │ │ ├── query-5d4d48b2d4af04b9fc16575d08a7a9c8c09fa0d1be2d596c3d86f68f190f438b.json │ │ ├── query-60b5176109f2072517a022e53891b7e1ece35b61aaa20f198785c61ee9d83d32.json │ │ ├── query-61977eb455a29c663ad3e344684e3dee119c43670b2443444bf7533cf51cb4a5.json │ │ ├── query-6834107f343e172f08ced4bc64e7099b7e27bd3e9a5ae96f77761fe12be375ff.json │ │ ├── query-69ab11dc3bcce3a4c6041ddc78e5ee3e537e77f4e61a21e34e9482d0b7539739.json │ │ ├── query-6ada31dbec7d933787f559f478c0c8b5b033420954542ea0ef592fe9b69c6b06.json │ │ ├── query-6e22844aaa743783bd0b0882b5558c600a8195845b10c5c744570a90de74e931.json │ │ ├── query-71f7eb6be5738bd525be4f3d0dd9d5e52b574ce6cc12bdbeedfdc9e7d65de352.json │ │ ├── query-72efcd2b9598423b2ac32fc51232e3da3bf281ae995f49993e09d6a8c519b382.json │ │ ├── query-744aa70813f522a41ee604dd444efcb1c59f2df067cd3fc215bbc0fab8386379.json │ │ ├── query-748ac769d3e4dfc3df429382f457413f3406f1fcb883171d1d0a2d24751631aa.json │ │ ├── query-749c598d03c6f8027e0213b14b630f0629add4e95db7920d11071b569244c1a2.json │ │ ├── query-75690af7f7b9997f2c326264023cdcddebc3ce70f8c7ca3ef2074bb70af23dc4.json │ │ ├── query-77a38773012336614a6792d685f611ef156f3086dc5a12ab5ee469b3c5fbd569.json │ │ ├── query-7a4ad681004a5ab19aaf14ccd54872fa8fc0b1dbca60b0b2e66c35545fe6d91b.json │ │ ├── query-7a829984353dc3e46b048e490508f23fed1dbff4dbfde741adf51d494ffa8390.json │ │ ├── query-7b6c749ca6610265fe282492f36609139f861bd87dabc5aa1726fc420a0bb7f0.json │ │ ├── query-88dfd802c80088d5cfc801c71fa5afb970f17bad1b7e2afe17ec285de45d6f97.json │ │ ├── query-89ce8031239f99f7346f67a9e409a2e4f8e99cdddd61934f84e08a1d274a7b68.json │ │ ├── query-8be140df31f27a59a5b2fb73908f657c0b2594cb58a90d5fd2bc51117f7b5efa.json │ │ ├── query-8f528010a6ce7892c527471a9db4c90733dfb0712e845be8aab32797f69ba469.json │ │ ├── query-9715f62dbaae02fd4f9ce3a7652adfa89268f3fbd546d9508adfe52a823686e2.json │ │ ├── query-a6b42b45300551f880dc21a0ce2a8b406ef191ccfe7c3991835bd17fcc59e485.json │ │ ├── query-a925f9cda2096ed6fec3b80a4ae4623d0e135ca5c88995867e66cfb024898170.json │ │ ├── query-abb47ada0a375bab61b6af5397237afa44143194976edbaeac14cae05038a493.json │ │ ├── query-acd799bcfa915ae5475d947c9e6a01a0b5166d18d24c303eb70fcc8f4a5e258c.json │ │ ├── query-b52036bab2b54cc5a1440770338a0718f875ac7e99680e6e4dcc22da415fb4a6.json │ │ ├── query-ba654f9767141e1d557bda5a9159b42007cf169328e6e0c41078868adf575647.json │ │ ├── query-bb50f239b607ff236b11a843a3724fc36ffc4c67e0d3fa58d43f763e08e15486.json │ │ ├── query-c75733dc5cf5d4bf9dad444ccb6587cdd2b46cce7076a6039c609be5896f710b.json │ │ ├── query-ca7597d520e0b3728884d0e3bed9845a76945ba86184590c46c3acaf3c47f242.json │ │ ├── query-cc88c22e1eef7e4f96c76549701867a15a38ec3b31e15d8e4a8adea6861fa215.json │ │ ├── query-cd5f86cda81740f873946246b820ead2c2fd3b550eac3aff9e3d5f1ebcd36b7c.json │ │ ├── query-d5283a2a6d9b921a4cfac71ce1c5f1b27be3db5e2daa474610eede82bdcbb78f.json │ │ ├── query-d62c42a65e39b7e77f32c39a80317e1628663f2436e1581d74744786b21461f1.json │ │ ├── query-d7e76694410b149d5f8ced42a401967eed6a861f2a820b7eff8ad7cf188da542.json │ │ ├── query-da6f2a4f13074082895e4512faafe19070d77854f816f5d0f9b927a8063d3052.json │ │ ├── query-e64342cc3b29b05d87e23d51b394f7154222a155ee3d8cc6acca7d0618f0f709.json │ │ ├── query-e79c15d9c1c9d4ad7413273d111170121bf1321ec30a2dd6469de54f4ef6c9aa.json │ │ ├── query-eb295d59e55fcd9b5e78715169160370b063119843e4f00d575cb44d348f7ad0.json │ │ ├── query-efa50ee481b4eb78f618788fdd09b123a336ef365ff82516440dafa4b7d32ea2.json │ │ ├── query-efcef792696e6d74041f87034d00c9b7a59b6aea8b6f78a5fb9ae8466a826a9b.json │ │ ├── query-f758a1d64a45f290ffd3608f68fe96e4035c0bf18bd8c3f129b79e1cc4434680.json │ │ ├── query-faf28d6116d9dadf33e57b5dc3b7b56e57b7323fd9fb5e4596865bdfc4b0bc75.json │ │ └── query-ffb221846f835515ad94e2f6b7fa6ffbe0c223004cb1fd6307909b497bef7e3a.json │ ├── Cargo.toml │ ├── migrations │ │ ├── 20211103220020_initial.sql │ │ ├── 20211109130523_script_contributes_commands.sql │ │ ├── 20211126152525_timers.sql │ │ ├── 20211126181955_guild_whitelist.sql │ │ ├── 20211204191757_bucketstore.sql │ │ ├── 20211229112329_scheduled_tasks.sql │ │ ├── 20220211194033_guild_left_at.sql │ │ ├── 20220314150414_premium.sql │ │ ├── 20220422120237_plugins.sql │ │ ├── 20230204071305_plugins_scripts.sql │ │ ├── 20230210150648_guild_scripts_unique_plugin_name.sql │ │ ├── 20230227165241_guild_scripts_plugin_version_number.sql │ │ ├── 20230313170215_plugin_soped_storage.sql │ │ ├── 20240207084404_prepend_custom_storage_scope.sql │ │ ├── 20240217073053_plugin_images.sql │ │ ├── 20240222112603_script_settings.sql │ │ ├── 20240311161022_stripe_customer_id.sql │ │ └── 20240618181258_plugin_stats.sql │ └── src │ │ ├── bucketstore.rs │ │ ├── config.rs │ │ ├── inmemory │ │ ├── mod.rs │ │ └── web.rs │ │ ├── lib.rs │ │ ├── timers.rs │ │ └── web.rs ├── stripe-premium │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── webhook_handler.rs ├── tscompiler │ ├── Cargo.toml │ └── src │ │ ├── compiler.rs │ │ └── lib.rs ├── validation │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── runtime.rs │ │ └── web.rs ├── vm │ ├── Cargo.toml │ ├── build.rs │ └── src │ │ ├── botloader-core-rt.js │ │ ├── botloader-core.js │ │ ├── lib.rs │ │ ├── moduleloader.rs │ │ ├── vm.rs │ │ └── vmthread.rs ├── vmworker │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ └── metrics_forwarder.rs └── webapi │ ├── Cargo.toml │ ├── Dockerfile │ └── src │ ├── app_state.rs │ ├── errors.rs │ ├── lib.rs │ ├── middlewares │ ├── bl_admin_only.rs │ ├── cors.rs │ ├── guild.rs │ ├── mod.rs │ ├── mw_session.rs │ └── plugins.rs │ ├── news_poller.rs │ ├── routes │ ├── admin.rs │ ├── auth.rs │ ├── errortest.rs │ ├── general.rs │ ├── guilds.rs │ ├── mod.rs │ ├── plugins.rs │ ├── premium.rs │ ├── scripts.rs │ ├── sessions.rs │ ├── stripe.rs │ ├── vm.rs │ └── ws.rs │ └── util.rs ├── frontend-common ├── .gitignore ├── package-lock.json ├── package.json ├── src │ ├── api_client.ts │ ├── api_models.ts │ ├── index.ts │ └── lib.d.ts └── tsconfig.json ├── frontend ├── .dockerignore ├── .gitignore ├── Dockerfile ├── README.md ├── config │ ├── env.js │ ├── getHttpsConfig.js │ ├── jest │ │ ├── babelTransform.js │ │ ├── cssTransform.js │ │ └── fileTransform.js │ ├── modules.js │ ├── paths.js │ ├── webpack.config.js │ ├── webpack │ │ └── persistentCache │ │ │ └── createEnvironmentHash.js │ └── webpackDevServer.config.js ├── nginx.conf ├── package-lock.json ├── package.json ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── run_using_api.sh ├── scripts │ ├── build.js │ ├── start.js │ └── test.js ├── src │ ├── App.css │ ├── App.tsx │ ├── BuildConfig.tsx │ ├── Util.tsx │ ├── components │ │ ├── AddPluginToServer.tsx │ │ ├── AsyncOpButton.tsx │ │ ├── BLLink.tsx │ │ ├── BotloaderSdk.ts │ │ ├── BreadCrumbs.tsx │ │ ├── CodeBlock.tsx │ │ ├── DateTime.tsx │ │ ├── DevConsole.css │ │ ├── DevConsole.tsx │ │ ├── DevelopmentIde.tsx │ │ ├── FetchData.tsx │ │ ├── Gist.tsx │ │ ├── GlobalState.tsx │ │ ├── GuildIcon.tsx │ │ ├── GuildScriptPage.tsx │ │ ├── GuildSelectionDialog.tsx │ │ ├── GuildSideNav.tsx │ │ ├── LinkRouter.tsx │ │ ├── Loading.tsx │ │ ├── NewsItem.tsx │ │ ├── Notifications.tsx │ │ ├── Panel.css │ │ ├── Panel.tsx │ │ ├── PluginIcon.tsx │ │ ├── PluginProvider.tsx │ │ ├── ScriptEditor.tsx │ │ ├── ScriptEditorWrapper.tsx │ │ ├── ScriptEnableToggle.tsx │ │ ├── Select.tsx │ │ ├── SideNav.tsx │ │ ├── SideNavManager.tsx │ │ ├── TopNav.tsx │ │ ├── Util.tsx │ │ └── useMonacoFixed.tsx │ ├── img │ │ ├── loaderscreenshot.png │ │ ├── pogshowcase.png │ │ ├── showcase_editor.png │ │ ├── showcase_plugin_settings.png │ │ └── showcase_plugins.png │ ├── index.css │ ├── index.tsx │ ├── misc │ │ ├── DebugMessages.ts │ │ ├── js-untar.d.ts │ │ ├── ourRoute.ts │ │ ├── pluginImageUrl.ts │ │ └── useTraceChangedProps.tsx │ ├── modules │ │ ├── guilds │ │ │ ├── CurrentGuild.tsx │ │ │ ├── FullGuildProvider.tsx │ │ │ ├── GuildScriptsProvider.tsx │ │ │ └── GuildsProvider.tsx │ │ ├── session │ │ │ ├── RequireLoggedInSession.tsx │ │ │ ├── SessionContext.tsx │ │ │ └── useSession.ts │ │ └── websocket │ │ │ ├── WebsocketContext.tsx │ │ │ ├── WebsocketController.ts │ │ │ └── useBotloaderWebsocket.tsx │ ├── pages │ │ ├── Landing.tsx │ │ ├── NewsPage.tsx │ │ ├── PrivacyPolicy.tsx │ │ ├── SamplesPage.css │ │ ├── SamplesPage.tsx │ │ ├── TOS.tsx │ │ ├── confirm_login │ │ │ └── index.tsx │ │ ├── confirm_stripe_purchase │ │ │ └── index.tsx │ │ ├── index.tsx │ │ ├── plugins │ │ │ ├── Plugins.tsx │ │ │ ├── [pluginId] │ │ │ │ ├── ViewPlugin.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── source │ │ │ │ │ └── index.tsx │ │ │ └── index.tsx │ │ ├── servers │ │ │ ├── SelectServer.css │ │ │ ├── SelectServer.tsx │ │ │ ├── [guilldId] │ │ │ │ ├── GuildPage.tsx │ │ │ │ ├── index.tsx │ │ │ │ └── scripts │ │ │ │ │ └── [script_id] │ │ │ │ │ ├── edit │ │ │ │ │ ├── EditScript.css │ │ │ │ │ ├── EditScript.tsx │ │ │ │ │ └── index.tsx │ │ │ │ │ └── index.tsx │ │ │ └── index.tsx │ │ └── user │ │ │ ├── general │ │ │ ├── General.tsx │ │ │ └── index.tsx │ │ │ ├── index.tsx │ │ │ ├── plugins │ │ │ ├── Scripts.tsx │ │ │ ├── [pluginId] │ │ │ │ ├── EditPlugin.tsx │ │ │ │ ├── EditPluginScript.tsx │ │ │ │ ├── edit_script │ │ │ │ │ └── index.tsx │ │ │ │ ├── edit_script_diff │ │ │ │ │ └── index.tsx │ │ │ │ └── index.tsx │ │ │ └── index.tsx │ │ │ └── premium │ │ │ ├── Premium.tsx │ │ │ └── index.tsx │ └── react-app-env.d.ts └── tsconfig.json ├── full-gen-types.sh ├── integration-tests ├── README.md ├── attachment.ts ├── bad_requests.ts ├── basic.ts ├── channels.ts ├── commands.ts ├── components.ts ├── emoji.ts ├── failing.ts.ignore ├── get_members.ts ├── http.ts ├── interval.ts ├── interval2.ts ├── invites.ts ├── lib.bl.core.d.ts ├── lib.ts ├── messagecreate.ts ├── messagespam.ts ├── permissions.ts ├── permissions2.ts ├── pins.ts ├── reactions.ts ├── reactions_events.ts.ignore ├── roles.ts ├── roles_order.ts.ignored ├── run.sh ├── settings.settings.json ├── settings.ts ├── storage_simple1.ts ├── storage_simple2.ts ├── storage_var.ts ├── storagev2.ts ├── tasks_data_size.ts ├── tasks_del.ts ├── tasks_get.ts ├── tasks_get_del_bucket.ts ├── tasks_simple.ts ├── tasks_simple_1m.ts ├── tasks_simple_bucket.ts ├── test_async_lock.ts ├── threads.ts ├── threads_events.ts ├── tsconfig.json └── webhooks.ts ├── notes ├── README.md └── plugins.md └── rt-changelog-breaking.md /.dockerignore: -------------------------------------------------------------------------------- 1 | target 2 | 3 | frontend/node_modules 4 | frontend/build 5 | frontend/public/docs 6 | frontend/.env 7 | 8 | botloader-vscode/node_modules 9 | botloader-vscode/out 10 | 11 | frontend-common/dist 12 | frontend-common/node_modules 13 | 14 | .env 15 | 16 | components/runtime/docgen/node_modules 17 | components/runtime/docgen/docs 18 | 19 | bl-compose/pgdata 20 | bl-compose/.env -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | 12 | # VSCode local configurations folder 13 | .vscode/ 14 | 15 | # Local environment variables 16 | .env 17 | 18 | bl-compose/pgdata 19 | bl-compose/.env 20 | components/jack-runtime/src/ts/*.d.ts 21 | scripts/*.d.ts 22 | scripts/bot/*.d.ts 23 | components/runtime/src/ts/typings 24 | 25 | **/node_modules -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # This is the base Docker file we use to build the executables 2 | # this way we can reuse the image layer caching across all the executables 3 | # since they mostly use the same ones anwyays 4 | FROM lukemathwalker/cargo-chef:latest-rust-1.81.0-bookworm AS chef 5 | WORKDIR /app 6 | 7 | FROM chef AS planner 8 | COPY . . 9 | RUN cargo chef prepare --recipe-path recipe.json 10 | 11 | FROM chef AS builder 12 | 13 | RUN apt update && apt install -y protobuf-compiler 14 | 15 | COPY --from=planner /app/recipe.json recipe.json 16 | # Build dependencies - this is the caching Docker layer! 17 | RUN cargo chef cook --release --recipe-path recipe.json 18 | # Install rustup 19 | RUN rustup component add rustfmt 20 | 21 | 22 | # Build application 23 | COPY . . 24 | -------------------------------------------------------------------------------- /bl-compose/.env-sample: -------------------------------------------------------------------------------- 1 | # You need to fill these in 2 | DISCORD_CLIENT_ID="FILL ME IN" 3 | DISCORD_CLIENT_SECRET="FILL ME IN" 4 | DISCORD_BOT_TOKEN="FILL ME IN" 5 | 6 | # These can be left untouched if you haven't changed the docker-compose file 7 | RUST_LOG=info,tower_http::trace=debug,sqlx=error,twilight_http=debug 8 | DATABASE_URL="postgresql://postgres:postgres@db:5432" 9 | BL_BROKER_RPC_CONNECT_ADDR="broker:7480" 10 | BL_BROKER_API_ADDR="http://broker:7449" 11 | WEBAPI_LISTEN_ADDR="0.0.0.0:7447" 12 | BOT_RPC_CONNECT_ADDR="http://schedulerwithworker:7448" 13 | FRONTEND_HOST_BASE="http://localhost:3000" -------------------------------------------------------------------------------- /bl-compose/README.md: -------------------------------------------------------------------------------- 1 | # Self hosting botloader: 2 | 3 | Note: this is **UNSAFE** to expose to the public due to no http proxy being set 4 | up. Users can make scripts that interacts with the internal API's. Do not expose 5 | this, this is only for development purposes. 6 | 7 | 1. Run the `build-all-images.sh` script, this will build all the docker images. 8 | 2. Copy the `.env-sample` file as `.env` and fill in the required fields 9 | 3. Update the bot application and add a new oauth2 redirect 10 | `http://localhost:3000/confirm_login` 11 | 4. Run `docker compose up` 12 | 5. It should now be running, navigate to `localhost:3000` in your browser to 13 | view it. 14 | -------------------------------------------------------------------------------- /bl-compose/build-all-images.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Building backend" 4 | ./build-image-backend.sh 5 | 6 | echo "Building frontend" 7 | ./build-image-frontend.sh -------------------------------------------------------------------------------- /bl-compose/build-image-backend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ./build-image-base.sh 4 | 5 | docker build -t botloader/backend -f ../cmd/backend/Dockerfile ../ -------------------------------------------------------------------------------- /bl-compose/build-image-base.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | docker build -t botloader-base -f ../Dockerfile ../ -------------------------------------------------------------------------------- /bl-compose/build-image-frontend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | echo "Using client id: $DISCORD_CLIENT_ID" 4 | docker build --build-arg BOTLOADER_API_BASE="http://localhost:7447" --build-arg BOTLOADER_CLIENT_ID="$DISCORD_CLIENT_ID" -t botloader/bl-frontend -f ../frontend/Dockerfile ../ 5 | -------------------------------------------------------------------------------- /bl-compose/run-only-frontend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | docker run -t -i -p 3000:80 botloader/bl-frontend:latest -------------------------------------------------------------------------------- /book/.gitignore: -------------------------------------------------------------------------------- 1 | book -------------------------------------------------------------------------------- /book/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["jonastar"] 3 | language = "en" 4 | multilingual = false 5 | src = "src" 6 | title = "Botloader Guide" 7 | site-url = "/book/" -------------------------------------------------------------------------------- /book/src/commands.md: -------------------------------------------------------------------------------- 1 | # Commands 2 | 3 | There are 3 types of commands: 4 | - Slash commands: these show up in the chat input area when you type a slash and can be ran through there 5 | - User commands: shows up when you right click on users 6 | - Message commands: shows up when you right click on messages -------------------------------------------------------------------------------- /book/src/images/components-sample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/book/src/images/components-sample.png -------------------------------------------------------------------------------- /book/src/interactions.md: -------------------------------------------------------------------------------- 1 | # Interactions 2 | 3 | This section has not been finished yet. You can find examples in the [support server](https://discord.gg/QyJeSf9rsR) -------------------------------------------------------------------------------- /book/src/interactions_handling.md: -------------------------------------------------------------------------------- 1 | # Handling interactions 2 | 3 | Use one of the `script.onInteraction*` functions to register a handler for a component with the provided name. 4 | 5 | To send a response you can either: 6 | - Update the message that triggered the interaction using `ackWithUpdateMessage` or `ackWithDeferredUpdateMessage` 7 | - Send a new message using `ackWithMessage` or `ackWithDeferredMessage` 8 | 9 | In the interaction handler you need to use one of the `ack*` functions to "acknowledge" the interaction within 3 seconds, if it might take longer you can use either `interaction.ackWithDeferredUpdateMessage` or `interaction.ackWithDeferredMessage` to tell discord you acknowledge it but need more time to send proper response. 10 | 11 | Components can also have additional data embedded in them, you can read more about that in the [component state](./interactions_state.md) section. -------------------------------------------------------------------------------- /book/src/introduction.md: -------------------------------------------------------------------------------- 1 | # Intro 2 | 3 | Botloader is a hosted programmable discord bot with no default functionality. Any functionality has to be added by the server admins. 4 | 5 | The bot is programmed using typescript and you can program it either through the Visual Studio Code extension or using the web based editor. 6 | 7 | This book contains various guides to creating botloader scripts. 8 | 9 | Note that this book is still relatively WIP. -------------------------------------------------------------------------------- /book/src/message_user_commands.md: -------------------------------------------------------------------------------- 1 | # User and Message commands 2 | 3 | This section has not been finished yet. You can find examples in the [support server](https://discord.gg/QyJeSf9rsR) -------------------------------------------------------------------------------- /book/src/script_lifecycle.md: -------------------------------------------------------------------------------- 1 | # Script lifecycle 2 | 3 | Internally botloader uses v8 for running your scripts but keeping all your scripts loaded in a v8 vm forever would be pretty inefficient, this is why botloader will shut down your vm when it's not needed and start it again once it's needed. 4 | 5 | Botloader will not shut down your vm until it's "done" (done meaning there are no more pending futures), or you have exceeded your quota (there is no quota at the time of writing, there will be premium plans in the future extending this quota). 6 | 7 | After your vm is shut down all variables set in it is lost. To get around this you can use the storage API, our key value based database to persist data and state. 8 | 9 | When you change a script botloader will also re-run all your scripts as it needs to know what new timers, task handlers, event handlers and so on have been added/removed. -------------------------------------------------------------------------------- /book/src/script_management.md: -------------------------------------------------------------------------------- 1 | # Script management 2 | 3 | Scripts are managed either through the Web-Based Code Editor or through Visual Studio Code. -------------------------------------------------------------------------------- /book/src/script_management_web.md: -------------------------------------------------------------------------------- 1 | # Script development on the web browser 2 | 3 | Note: the web editor does not support mobile. 4 | 5 | To manage your servers scripts, you log onto the website, click select server in the top right and select your server. 6 | 7 | After that you will have a sidebar on the left, click on the "scripts" entry to manage your server scripts. 8 | 9 | From here you can create, delete and toggle a scripts enabled/disabled status. 10 | 11 | If you click on the `edit` button you will be taken to the web editor based on `Monaco`. 12 | 13 | In the web editor you will have full intellisense and autocomplete support. 14 | 15 | To deploy your changes simply press `ctrl-s` or the save button on the right. -------------------------------------------------------------------------------- /book/src/slash_commands.md: -------------------------------------------------------------------------------- 1 | # Slash commands 2 | 3 | This section has not been finished yet. You can find examples in the [support server](https://discord.gg/QyJeSf9rsR) -------------------------------------------------------------------------------- /book/src/timers.md: -------------------------------------------------------------------------------- 1 | # Timers 2 | 3 | Botloader does not provide a `setTimeout` or `setInterval` function that you may be familiar from the browser for reasons being it would keep your vm loaded while doing no work, effectively wasting resources. To get around this botloader provides the following: 4 | 5 | - [script.onInterval](interval_timers.md) for executing a function on a interval. [API](https://botloader.io/docs/classes/Script.html#onInterval) 6 | - [Scheduled Tasks](scheduled_tasks.md) for scheduling something to be run at a specific time in the future. -------------------------------------------------------------------------------- /botloader-vscode/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | out -------------------------------------------------------------------------------- /botloader-vscode/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": "warn", 13 | "@typescript-eslint/semi": "warn", 14 | "curly": "warn", 15 | "eqeqeq": "warn", 16 | "no-throw-literal": "warn", 17 | "semi": "off" 18 | }, 19 | "ignorePatterns": [ 20 | "out", 21 | "dist", 22 | "**/*.d.ts" 23 | ] 24 | } 25 | -------------------------------------------------------------------------------- /botloader-vscode/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | out -------------------------------------------------------------------------------- /botloader-vscode/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | vsc-extension-quickstart.md 7 | **/tsconfig.json 8 | **/.eslintrc.json 9 | **/*.map -------------------------------------------------------------------------------- /botloader-vscode/README.md: -------------------------------------------------------------------------------- 1 | # botloader-vscode README 2 | 3 | 4 | ## Features 5 | 6 | Botloader integration for vs-code. 7 | 8 | Botloader is a programmable discord bot that is currently in closed alpha testing. 9 | 10 | ## Requirements 11 | 12 | Requires nodejs to be installed 13 | 14 | ## Release Notes 15 | 16 | ### 0.0.3 17 | - updated typings 18 | 19 | ### 0.0.2 20 | - fix typings not being included. 21 | 22 | ### 0.0.1 23 | 24 | - first publish, we got basic functionality working. 25 | -------------------------------------------------------------------------------- /botloader-vscode/src/models.ts: -------------------------------------------------------------------------------- 1 | import { UserGuild } from "botloader-common"; 2 | 3 | export interface IndexFile { 4 | guild: UserGuild, 5 | openScripts: IndexScript[], 6 | } 7 | 8 | export interface IndexScript { 9 | id: number, 10 | name: string, 11 | } -------------------------------------------------------------------------------- /botloader-vscode/src/test/runTest.ts: -------------------------------------------------------------------------------- 1 | import * as path from 'path'; 2 | 3 | import { runTests } from '@vscode/test-electron'; 4 | 5 | async function main() { 6 | try { 7 | // The folder containing the Extension Manifest package.json 8 | // Passed to `--extensionDevelopmentPath` 9 | const extensionDevelopmentPath = path.resolve(__dirname, '../../'); 10 | 11 | // The path to test runner 12 | // Passed to --extensionTestsPath 13 | const extensionTestsPath = path.resolve(__dirname, './suite/index'); 14 | 15 | // Download VS Code, unzip it and run the integration test 16 | await runTests({ extensionDevelopmentPath, extensionTestsPath }); 17 | } catch (err) { 18 | console.error('Failed to run tests'); 19 | process.exit(1); 20 | } 21 | } 22 | 23 | main(); 24 | -------------------------------------------------------------------------------- /botloader-vscode/src/test/suite/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | 11 | test('Sample test', () => { 12 | assert.strictEqual(-1, [1, 2, 3].indexOf(5)); 13 | assert.strictEqual(-1, [1, 2, 3].indexOf(0)); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /botloader-vscode/src/util.ts: -------------------------------------------------------------------------------- 1 | import fetch from 'node-fetch'; 2 | import { ApiFetcher } from "botloader-common"; 3 | 4 | export function createFetcher(): ApiFetcher { 5 | return { 6 | fetch: async (path, opts) => await fetch(path, opts) 7 | }; 8 | } -------------------------------------------------------------------------------- /botloader-vscode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "ES2020", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2020" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | // "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | }, 17 | "exclude": [ 18 | "node_modules", 19 | ".vscode-test" 20 | ] 21 | } -------------------------------------------------------------------------------- /build-frontend-with-docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # cd to the script location 5 | cd "${0%/*}" 6 | 7 | # build docs 8 | cd components/runtime/docgen 9 | npm install 10 | npm run build 11 | cd - 12 | 13 | # copy docs to frontend 14 | cp -r components/runtime/docgen/docs frontend/public/docs 15 | 16 | # build frontend 17 | cd frontend-common 18 | npm install 19 | cd ../frontend 20 | npm install 21 | npm run build -------------------------------------------------------------------------------- /cmd/backend/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "backend" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | scheduler = { path = "../../components/scheduler" } 10 | discordbroker = { path = "../../components/discordbroker" } 11 | webapi = { path = "../../components/webapi" } 12 | jobs = { path = "../../components/jobs" } 13 | vmworker = { path = "../../components/vmworker" } 14 | 15 | common = { path = "../../components/common" } 16 | 17 | clap = { workspace = true } 18 | tokio = { workspace = true } 19 | 20 | rustls = { version = "0.23" } 21 | -------------------------------------------------------------------------------- /cmd/backend/Dockerfile: -------------------------------------------------------------------------------- 1 | # You need to build the base image first and tag it as botloader-base 2 | FROM botloader-base as builder 3 | RUN cargo build --release --bin backend 4 | 5 | #run 6 | FROM debian:bookworm AS runtime 7 | WORKDIR /app 8 | COPY --from=builder /app/target/release/backend /usr/local/bin/backend 9 | 10 | 11 | RUN apt-get update 12 | RUN apt-get install ca-certificates -y 13 | 14 | RUN apt-get update 15 | RUN apt-get install ca-certificates -y 16 | 17 | ENV BL_BROKER_RPC_LISTEN_ADDR="0.0.0.0:7480" 18 | EXPOSE 7480 19 | 20 | ENV BL_BROKER_HTTP_API_LISTEN_ADDR="0.0.0.0:7449" 21 | EXPOSE 7449 22 | 23 | ENV BOT_RPC_LISTEN_ADDR="0.0.0.0:7448" 24 | EXPOSE 7448 25 | 26 | # scheduler metrics 27 | EXPOSE 7803 28 | 29 | # broker metrics 30 | EXPOSE 7802 31 | 32 | # webapi metrics 33 | EXPOSE 7801 34 | 35 | # webapi listen addr 36 | EXPOSE 7447 37 | 38 | 39 | ENTRYPOINT ["/usr/local/bin/backend"] -------------------------------------------------------------------------------- /cmd/blcmd/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "blcmd" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../../components/stores" } 10 | common = { path = "../../components/common" } 11 | 12 | twilight-model = { workspace = true } 13 | 14 | tracing = { workspace = true } 15 | tracing-log = { workspace = true } 16 | 17 | tokio = { workspace = true } 18 | clap = { workspace = true } 19 | regex = { workspace = true } 20 | serde = { workspace = true } 21 | serde_json = { workspace = true } 22 | anyhow = { workspace = true } 23 | confy = "0.4.0" 24 | reqwest = { workspace = true } 25 | -------------------------------------------------------------------------------- /cmd/dbmigrations/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM rust:1.75 2 | 3 | RUN cargo install sqlx-cli 4 | 5 | WORKDIR /usr/src/myapp 6 | 7 | COPY components/stores/migrations ./migrations 8 | 9 | CMD ["sqlx", "migrate", "run"] 10 | -------------------------------------------------------------------------------- /cmd/dbserver/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dbserver" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | common = { path = "../../components/common" } 10 | axum-metrics-layer = { path = "../../components/axum-metrics-layer" } 11 | stores = { path = "../../components/stores" } 12 | 13 | 14 | axum = { workspace = true } 15 | tokio = { workspace = true } 16 | clap = { workspace = true } 17 | tracing = { workspace = true } 18 | futures-util = "0.3" 19 | serde = { workspace = true } 20 | serde_json = { workspace = true } 21 | metrics = { workspace = true } 22 | -------------------------------------------------------------------------------- /cmd/dbserver/Dockerfile: -------------------------------------------------------------------------------- 1 | # You need to build the base image first and tag it as botloader-base 2 | FROM botloader-base as builder 3 | RUN cargo build --release --bin dbserver 4 | 5 | #run 6 | FROM debian:bookworm AS runtime 7 | WORKDIR /app 8 | COPY --from=builder /app/target/release/dbserver /usr/local/bin/botloader-dbserver 9 | 10 | RUN apt-get update 11 | RUN apt-get install ca-certificates -y 12 | 13 | ENV BL_DB_API_HTTP_LISTEN_ADDR="0.0.0.0:7900" 14 | EXPOSE 7900 15 | 16 | # metrics 17 | EXPOSE 7804 18 | 19 | ENTRYPOINT ["/usr/local/bin/botloader-dbserver"] -------------------------------------------------------------------------------- /cmd/prepare-integration-tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "prepare-integration-tests" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../../components/stores" } 10 | common = { path = "../../components/common" } 11 | runtime-models = { path = "../../components/runtime-models" } 12 | 13 | twilight-model = { workspace = true } 14 | 15 | tracing = { workspace = true } 16 | tracing-log = { workspace = true } 17 | serde = { workspace = true } 18 | serde_json = { workspace = true } 19 | 20 | tokio = { workspace = true } 21 | clap = { workspace = true } 22 | regex = { workspace = true } 23 | chrono = { workspace = true } 24 | -------------------------------------------------------------------------------- /components/axum-metrics-layer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "axum-metrics-layer" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | axum = { workspace = true } 10 | metrics = { workspace = true } 11 | tower = "0.4" 12 | futures = { workspace = true } 13 | -------------------------------------------------------------------------------- /components/botrpc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "botrpc" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../../components/stores" } 10 | guild-logger = { path = "../../components/guild-logger" } 11 | 12 | async-trait = { workspace = true } 13 | tracing = { workspace = true } 14 | tonic = { workspace = true } 15 | prost = "0.12.3" 16 | tokio = { workspace = true } 17 | futures = { workspace = true } 18 | 19 | twilight-model = { workspace = true } 20 | 21 | [build-dependencies] 22 | tonic-build = "0.10.2" 23 | -------------------------------------------------------------------------------- /components/botrpc/README.md: -------------------------------------------------------------------------------- 1 | This crate defines and implements a basic bot rpc protocol over gRPC. 2 | 3 | This is used to communicate with the bot from somewhere else (for example the webserver) -------------------------------------------------------------------------------- /components/botrpc/build.rs: -------------------------------------------------------------------------------- 1 | fn main() -> Result<(), Box> { 2 | tonic_build::compile_protos("proto/botrpc.proto")?; 3 | Ok(()) 4 | } 5 | -------------------------------------------------------------------------------- /components/botrpc/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![doc = include_str!("../README.md")] 2 | 3 | pub mod client; 4 | pub mod proto; 5 | 6 | pub use client::Client; 7 | -------------------------------------------------------------------------------- /components/common/src/dispatch_event.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Serialize}; 2 | 3 | #[derive(Debug, Deserialize, Serialize, Clone, Copy)] 4 | pub enum EventSource { 5 | Discord, 6 | Timer, 7 | } 8 | 9 | #[derive(Debug, Clone, Deserialize, Serialize)] 10 | pub struct VmDispatchEvent { 11 | pub name: String, 12 | pub seq: u64, 13 | pub value: serde_json::Value, 14 | pub source: EventSource, 15 | pub source_timestamp: chrono::DateTime, 16 | } 17 | -------------------------------------------------------------------------------- /components/common/src/user.rs: -------------------------------------------------------------------------------- 1 | pub struct UserMeta { 2 | pub discord_user_id: u64, 3 | pub is_admin: bool, 4 | pub is_moderator: bool, 5 | pub is_verified: bool, 6 | pub stripe_customer_id: Option, 7 | } 8 | -------------------------------------------------------------------------------- /components/dbrokerapi/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "dbrokerapi" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | serde = { workspace = true } 10 | reqwest = { workspace = true } 11 | thiserror = "1.0" 12 | serde_json = { workspace = true } 13 | 14 | chrono = { workspace = true } 15 | twilight-model = { workspace = true } 16 | -------------------------------------------------------------------------------- /components/dbrokerapi/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod broker_scheduler_rpc; 2 | pub mod models; 3 | pub mod state_client; 4 | -------------------------------------------------------------------------------- /components/dbrokerapi/src/models/member.rs: -------------------------------------------------------------------------------- 1 | use serde::Deserialize; 2 | use twilight_model::{ 3 | id::{ 4 | marker::{GuildMarker, RoleMarker, UserMarker}, 5 | Id, 6 | }, 7 | util::Timestamp, 8 | }; 9 | 10 | #[derive(Clone, Debug, Deserialize)] 11 | pub struct BrokerMember { 12 | pub avatar: Option, 13 | pub communication_disabled_until: Option, 14 | pub deaf: Option, 15 | pub guild_id: Id, 16 | pub joined_at: Timestamp, 17 | pub mute: Option, 18 | pub nick: Option, 19 | pub pending: bool, 20 | pub premium_since: Option, 21 | pub roles: Vec>, 22 | pub user_id: Id, 23 | } 24 | -------------------------------------------------------------------------------- /components/dbrokerapi/src/models/mod.rs: -------------------------------------------------------------------------------- 1 | /// The twilight cache models don't implement deserialize, so this just duplicates the structs for deserialization purposes 2 | mod guild; 3 | mod member; 4 | 5 | pub use guild::*; 6 | pub use member::*; 7 | -------------------------------------------------------------------------------- /components/discordbroker/Dockerfile: -------------------------------------------------------------------------------- 1 | # You need to build the base image first and tag it as botloader-base 2 | FROM botloader-base as builder 3 | RUN cargo build --release --bin discordbroker 4 | 5 | #run 6 | FROM debian:bookworm AS runtime 7 | WORKDIR /app 8 | COPY --from=builder /app/target/release/discordbroker /usr/local/bin/botloader-discordbroker 9 | 10 | RUN apt-get update 11 | RUN apt-get install ca-certificates -y 12 | 13 | ENV BL_BROKER_RPC_LISTEN_ADDR="0.0.0.0:7480" 14 | EXPOSE 7480 15 | 16 | ENV BL_BROKER_HTTP_API_LISTEN_ADDR="0.0.0.0:7449" 17 | EXPOSE 7449 18 | 19 | # metrics 20 | EXPOSE 7802 21 | 22 | 23 | ENTRYPOINT ["/usr/local/bin/botloader-discordbroker"] -------------------------------------------------------------------------------- /components/discordbroker/src/dispatch_server.rs: -------------------------------------------------------------------------------- 1 | use tokio::net::TcpListener; 2 | 3 | use crate::broker::{BrokerCommand, BrokerHandle}; 4 | 5 | pub async fn start_server(addr: String, broker: BrokerHandle) { 6 | let listener = TcpListener::bind(addr).await.unwrap(); 7 | 8 | loop { 9 | let (socket, _) = listener.accept().await.unwrap(); 10 | socket.set_nodelay(true).unwrap(); 11 | if broker 12 | .send(BrokerCommand::SchedulerConnected(socket)) 13 | .is_err() 14 | { 15 | return; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /components/discordoauthwrapper/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "discordoauthwrapper" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../../components/stores" } 10 | 11 | async-trait = { workspace = true } 12 | oauth2 = { workspace = true } 13 | tokio = { workspace = true } 14 | anyhow = { workspace = true } 15 | lru = "0.7" 16 | 17 | twilight-model = { workspace = true } 18 | twilight-http = { workspace = true } 19 | -------------------------------------------------------------------------------- /components/guild-logger/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "guild-logger" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | common = {path="../../components/common"} 10 | stores = {path="../../components/stores"} 11 | 12 | async-trait = {workspace = true} 13 | tokio = {workspace = true} 14 | tracing = {workspace = true} 15 | serde = {workspace = true} 16 | 17 | twilight-http = {workspace = true} 18 | twilight-model = {workspace = true} -------------------------------------------------------------------------------- /components/guild-logger/README.md: -------------------------------------------------------------------------------- 1 | This is a pretty simple crate for handling log entries that should be sent to guilds, for example script errors. 2 | 3 | Its made like this: 4 | 1. Make a GuildLoggerBuilder 5 | 2. Add backends to it 6 | 3. Call run() on it and you can use the return of that to log stuff to guilds. 7 | 8 | Backends are what handles the actual log entries the current ones are: 9 | - DiscordLogger: sends log entries to the guilds configured logging channel 10 | - GuildSubscriberBackend: Handles dynamic subscriptions to a guilds logs, such as to the websocket (over botrpc) -------------------------------------------------------------------------------- /components/jobs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "jobs" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | common = { path = "../../components/common" } 10 | stores = { path = "../../components/stores" } 11 | dbrokerapi = { path = "../../components/dbrokerapi" } 12 | 13 | tracing = { workspace = true } 14 | clap = { workspace = true } 15 | tokio = { workspace = true } 16 | anyhow = { workspace = true } 17 | chrono = { workspace = true } 18 | twilight-http = { workspace = true } 19 | -------------------------------------------------------------------------------- /components/runtime-models/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "runtime-models" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | # stores = { path = "../../components/stores" } 10 | dbrokerapi = { path = "../../components/dbrokerapi" } 11 | 12 | serde_json = { workspace = true } 13 | # ts-rs = {version = "6.2.1", features=["format"]} 14 | ts-rs = { version = "7.0.0", features = ["format"] } 15 | serde = { version = "1.0", features = ["derive"] } 16 | tracing = { workspace = true } 17 | anyhow = { workspace = true } 18 | image = { workspace = true } 19 | base64-simd = { workspace = true } 20 | 21 | twilight-model = { workspace = true } 22 | twilight-cache-inmemory = { workspace = true } 23 | twilight-http = { workspace = true } 24 | twilight-validate = { workspace = true } 25 | -------------------------------------------------------------------------------- /components/runtime-models/gen-move-types.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # cd to the script location 5 | cd "${0%/*}" 6 | 7 | # generate the types 8 | cargo t 9 | 10 | # generate indexes 11 | ./gen-index.bash 12 | 13 | # move bindings 14 | if [ -d "../runtime/src/ts/generated" ]; then 15 | rm -r ../runtime/src/ts/generated 16 | fi 17 | mv bindings/ ../runtime/src/ts/generated -------------------------------------------------------------------------------- /components/runtime-models/src/discord/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod channel; 2 | pub mod component; 3 | pub mod embed; 4 | pub mod events; 5 | pub mod guild; 6 | pub mod invite; 7 | pub mod member; 8 | pub mod message; 9 | pub mod role; 10 | pub mod util; 11 | -------------------------------------------------------------------------------- /components/runtime-models/src/discord/util.rs: -------------------------------------------------------------------------------- 1 | use serde::Deserialize; 2 | use ts_rs::TS; 3 | 4 | #[derive(Clone, Debug, Deserialize, TS)] 5 | #[ts(export)] 6 | #[serde(rename_all = "camelCase")] 7 | #[ts(export_to = "bindings/discord/AuditLogExtras.ts")] 8 | pub struct AuditLogExtras { 9 | #[serde(skip_serializing_if = "Option::is_none")] 10 | pub audit_log_reason: Option, 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime-models/src/internal/components.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /components/runtime-models/src/internal/console.rs: -------------------------------------------------------------------------------- 1 | use serde::Deserialize; 2 | use ts_rs::TS; 3 | 4 | #[derive(Clone, Debug, Deserialize, TS)] 5 | #[ts(export)] 6 | #[ts(export_to = "bindings/internal/ConsoleLogMessage.ts")] 7 | #[serde(rename_all = "camelCase")] 8 | pub struct ConsoleLogMessage { 9 | #[serde(default)] 10 | #[ts(optional)] 11 | pub file_name: Option, 12 | #[serde(default)] 13 | #[ts(optional)] 14 | pub line_number: Option, 15 | #[serde(default)] 16 | #[ts(optional)] 17 | pub col_number: Option, 18 | 19 | pub message: String, 20 | 21 | pub level: ConsoleLogLevel, 22 | } 23 | 24 | #[derive(Clone, Debug, Deserialize, TS)] 25 | #[ts(export)] 26 | #[ts(export_to = "bindings/internal/ConsoleLogLevel.ts")] 27 | #[serde(rename_all = "camelCase")] 28 | pub enum ConsoleLogLevel { 29 | Log, 30 | Warn, 31 | Error, 32 | } 33 | -------------------------------------------------------------------------------- /components/runtime-models/src/internal/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod channel; 2 | pub mod console; 3 | pub mod emoji; 4 | pub mod events; 5 | pub mod httpclient; 6 | pub mod interaction; 7 | pub mod interactions; 8 | pub mod invite; 9 | pub mod member; 10 | pub mod messages; 11 | pub mod misc_op; 12 | pub mod role; 13 | pub mod script; 14 | pub mod storage; 15 | pub mod tasks; 16 | pub mod timers; 17 | pub mod user; 18 | pub mod webhook; 19 | -------------------------------------------------------------------------------- /components/runtime-models/src/internal/timers.rs: -------------------------------------------------------------------------------- 1 | use serde::Serialize; 2 | use ts_rs::TS; 3 | 4 | use crate::util::PluginId; 5 | 6 | #[derive(Clone, Debug, Serialize, TS)] 7 | #[ts(export)] 8 | #[ts(export_to = "bindings/internal/IntervalTimerEvent.ts")] 9 | #[serde(rename_all = "camelCase")] 10 | pub struct IntervalTimerEvent { 11 | pub name: String, 12 | pub plugin_id: Option, 13 | } 14 | -------------------------------------------------------------------------------- /components/runtime-models/src/lib.rs: -------------------------------------------------------------------------------- 1 | use serde::{Deserialize, Deserializer}; 2 | 3 | pub mod discord; 4 | pub mod image; 5 | pub mod internal; 6 | pub mod ops; 7 | pub mod util; 8 | 9 | pub(crate) fn deserialize_undefined_null_optional_field<'de, T, D>( 10 | deserializer: D, 11 | ) -> Result>, D::Error> 12 | where 13 | D: Deserializer<'de>, 14 | T: Deserialize<'de>, 15 | { 16 | Ok(Some(Option::deserialize(deserializer)?)) 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/docgen/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | docs -------------------------------------------------------------------------------- /components/runtime/docgen/README.md: -------------------------------------------------------------------------------- 1 | Doc generator for the runtime ts stdlib. 2 | 3 | Run `npm run build` to generate the docs in the `./docs` folder. -------------------------------------------------------------------------------- /components/runtime/docgen/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "docgen", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "src/index.js", 6 | "scripts": { 7 | "build": "node src/index.js" 8 | }, 9 | "author": "", 10 | "type": "module", 11 | "license": "ISC", 12 | "devDependencies": { 13 | "typedoc": "^0.25.7" 14 | } 15 | } -------------------------------------------------------------------------------- /components/runtime/docgen/src/README.md: -------------------------------------------------------------------------------- 1 | # Botloader scripting API documentation 2 | 3 | This is the reference for the Botloader runtime typescript API. 4 | 5 | At the core, all scripts have a `script` global variable defined that you use to interact with the bot. see the [[Script]] class for more info on what you can do with it. 6 | 7 | Everything is exported under the `botloader` module. 8 | Example import: `import { Discord, Tasks } from 'botloader';` 9 | 10 | For example scripts join the discord and check the examples channel. 11 | 12 | Check out [the book (wip)](/book/) for more in-depth guides. -------------------------------------------------------------------------------- /components/runtime/src/jsmodules.rs: -------------------------------------------------------------------------------- 1 | use vm::moduleloader::ModuleEntry; 2 | 3 | macro_rules! include_js { 4 | ($f:tt) => { 5 | include_str!(concat!(env!("OUT_DIR"), concat!("/js/", $f))) 6 | }; 7 | } 8 | 9 | include!(concat!(env!("OUT_DIR"), "/module_map.rs")); 10 | 11 | pub fn create_module_map() -> Vec { 12 | MODULE_MAP 13 | .iter() 14 | .map(|(name, source)| ModuleEntry { 15 | source, 16 | specifier: name.clone(), 17 | }) 18 | .collect() 19 | } 20 | -------------------------------------------------------------------------------- /components/runtime/src/ts/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "jsc": { 3 | "parser": { 4 | "syntax": "typescript", 5 | "tsx": false, 6 | "decorators": false, 7 | "dynamicImport": false 8 | }, 9 | "transform": null, 10 | "loose": false, 11 | "externalHelpers": false, 12 | "keepClassNames": false, 13 | "target": "es2020" 14 | } 15 | } -------------------------------------------------------------------------------- /components/runtime/src/ts/build-types-copy-frontend.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # cd to the script location 5 | cd "${0%/*}" 6 | 7 | if [ -d "./typings" ]; then 8 | rm -r typings 9 | fi 10 | 11 | npx tsc --build tsconfig.json 12 | 13 | # mkdir typings 14 | # mv *.d.ts typings 15 | 16 | cp -r globals typings 17 | tar -cf typings.tar typings/ 18 | mv typings.tar ../../../../frontend/public/typings.tar -------------------------------------------------------------------------------- /components/runtime/src/ts/discord/common.ts: -------------------------------------------------------------------------------- 1 | export type CdnImageSize = 16 | 32 | 64 | 128 | 256 | 512 | 1024 | 2048 | 4096; -------------------------------------------------------------------------------- /components/runtime/src/ts/discord/index.ts: -------------------------------------------------------------------------------- 1 | export * from './dapi'; 2 | export * from './interaction'; 3 | export * from './message'; 4 | export * from './member'; 5 | export * from './channel'; 6 | export * from './events'; 7 | export * from './user'; 8 | export * from './error'; 9 | export * from './common'; 10 | export * from './components'; 11 | export * from './permissions'; 12 | export * from './snowflake'; 13 | export * from './webhook'; 14 | export * from '../generated/discord/index'; 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/discord/snowflake.ts: -------------------------------------------------------------------------------- 1 | export const DiscordEpoch = 1420070400000n; 2 | 3 | /** 4 | * Gets the timestamp from a Discord ID. 5 | * @param id The snowflake to deconstruct. 6 | * @returns The snowflake timestamp. 7 | */ 8 | export function snowflakeTimestamp(id: string): number { 9 | return Number((BigInt(id) >> 22n) + DiscordEpoch); 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/docs_index.ts: -------------------------------------------------------------------------------- 1 | // Important: core_util provides globals so don't remove it 2 | export * from './core_util'; 3 | 4 | // export * from './timers'; 5 | export * from './commands'; 6 | export * from './eventsystem'; 7 | export * from './script'; 8 | export * from './storage'; 9 | export * from './httpclient'; 10 | export * from './image'; 11 | export * from './scheduled_tasks'; 12 | export * as Settings from './settings'; 13 | export * as Discord from './discord/index'; 14 | export * as Unstable from './unstable/index'; 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/Attachment.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface Attachment { 4 | contentType: string | null; 5 | filename: string; 6 | height: number | null; 7 | id: string; 8 | proxyUrl: string; 9 | size: number; 10 | url: string; 11 | width: number | null; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/AuditLogExtras.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface AuditLogExtras { 4 | auditLogReason?: string; 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ButtonStyle.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ButtonStyle = 4 | | "Primary" 5 | | "Secondary" 6 | | "Success" 7 | | "Danger" 8 | | "Link" 9 | | "Premium"; 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ChannelMention.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "./ChannelType"; 3 | 4 | export interface ChannelMention { 5 | guildId: string; 6 | id: string; 7 | kind: ChannelType; 8 | name: string; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ChannelType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ChannelType = 4 | | "Text" 5 | | "Voice" 6 | | "Category" 7 | | "News" 8 | | "StageVoice" 9 | | "NewsThread" 10 | | "PublicThread" 11 | | "PrivateThread" 12 | | "GuildDirectory" 13 | | "Forum" 14 | | "Media"; 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ComponentType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ComponentType = 4 | | "ActionRow" 5 | | "Button" 6 | | "SelectMenu" 7 | | "TextInput" 8 | | "UserSelectMenu" 9 | | "RoleSelectMenu" 10 | | "MentionableSelectMenu" 11 | | "ChannelSelectMenu"; 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/DefaultMessageNotificationLevel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type DefaultMessageNotificationLevel = "All" | "Mentions"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedAuthor.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedAuthor { 4 | name: string; 5 | iconUrl?: string; 6 | proxyIconUrl?: string; 7 | url?: string; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedField.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedField { 4 | inline?: boolean; 5 | name: string; 6 | value: string; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedFooter.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedFooter { 4 | text: string; 5 | iconUrl?: string; 6 | proxyIconUrl?: string; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedImage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedImage { 4 | url: string; 5 | height?: number; 6 | proxyUrl?: string; 7 | width?: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedProvider.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedProvider { 4 | name?: string; 5 | url?: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedThumbnail.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedThumbnail { 4 | url: string; 5 | height?: number; 6 | proxyUrl?: string; 7 | width?: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EmbedVideo.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EmbedVideo { 4 | url?: string; 5 | height?: number; 6 | proxyUrl?: string; 7 | width?: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EventMessageDelete.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EventMessageDelete { 4 | channelId: string; 5 | id: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EventMessageReactionRemove.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ReactionType } from "./ReactionType"; 3 | 4 | export interface EventMessageReactionRemove { 5 | channelId: string; 6 | messageId: string; 7 | emoji: ReactionType; 8 | userId: string; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EventMessageReactionRemoveAll.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EventMessageReactionRemoveAll { 4 | channelId: string; 5 | messageId: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EventMessageReactionRemoveAllEmoji.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ReactionType } from "./ReactionType"; 3 | 4 | export interface EventMessageReactionRemoveAllEmoji { 5 | channelId: string; 6 | messageId: string; 7 | emoji: ReactionType; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/EventRoleDelete.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface EventRoleDelete { 4 | roleId: string; 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ExplicitContentFilter.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ExplicitContentFilter = 4 | | "None" 5 | | "MembersWithoutRole" 6 | | "AllMembers"; 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IActionRow.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IComponent } from "./IComponent"; 3 | 4 | export interface IActionRow { 5 | components: Array; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IButton.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ButtonStyle } from "./ButtonStyle"; 3 | import type { ReactionType } from "./ReactionType"; 4 | 5 | export interface IButton { 6 | customId?: string; 7 | style: ButtonStyle; 8 | disabled?: boolean; 9 | url?: string; 10 | label?: string; 11 | emoji?: ReactionType; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IComponent.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IActionRow } from "./IActionRow"; 3 | import type { IButton } from "./IButton"; 4 | import type { ISelectMenu } from "./ISelectMenu"; 5 | import type { ITextInput } from "./ITextInput"; 6 | import type { IUnknownComponent } from "./IUnknownComponent"; 7 | 8 | export type IComponent = 9 | | { "kind": "ActionRow" } & IActionRow 10 | | { "kind": "Button" } & IButton 11 | | { "kind": "SelectMenu" } & ISelectMenu 12 | | { "kind": "TextInput" } & ITextInput 13 | | { "kind": "UserSelectMenu" } & ISelectMenu 14 | | { "kind": "RoleSelectMenu" } & ISelectMenu 15 | | { "kind": "MentionableSelectMenu" } & ISelectMenu 16 | | { "kind": "ChannelSelectMenu" } & ISelectMenu 17 | | { "kind": "Unknown" } & IUnknownComponent; 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IEventThreadDelete.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "./ChannelType"; 3 | 4 | export interface IEventThreadDelete { 5 | guildId: string; 6 | id: string; 7 | kind: ChannelType; 8 | parentId: string; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IInviteChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "./ChannelType"; 3 | 4 | export interface IInviteChannel { 5 | id: string; 6 | name?: string; 7 | type: ChannelType; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IInviteGuild.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { VerificationLevel } from "./VerificationLevel"; 3 | 4 | export interface IInviteGuild { 5 | banner: string | null; 6 | description: string | null; 7 | features: Array; 8 | icon: string | null; 9 | id: string; 10 | name: string; 11 | premiumSubscriptionCount: number | null; 12 | splash: string | null; 13 | vanityUrlCode: string | null; 14 | verificationLevel: VerificationLevel; 15 | } 16 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IInviteTargetUser.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IInviteTargetUser { 4 | avatar: string | null; 5 | discriminator: string; 6 | id: string; 7 | username: string; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IPermissionOverwrite.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { PermissionOverwriteType } from "./PermissionOverwriteType"; 3 | 4 | export interface IPermissionOverwrite { 5 | allowRaw: string; 6 | denyRaw: string; 7 | kind: PermissionOverwriteType; 8 | id: string; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ISelectMenu.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "./ChannelType"; 3 | import type { ISelectMenuOption } from "./ISelectMenuOption"; 4 | import type { SelectDefaultValue } from "./SelectDefaultValue"; 5 | import type { SelectMenuType } from "./SelectMenuType"; 6 | 7 | export interface ISelectMenu { 8 | customId: string; 9 | disabled: boolean; 10 | minValues?: number; 11 | maxValues?: number; 12 | options: Array; 13 | placeholder?: string; 14 | selectType: SelectMenuType; 15 | channelTypes?: Array; 16 | defaultValues?: Array; 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ISelectMenuOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ReactionType } from "./ReactionType"; 3 | 4 | export interface ISelectMenuOption { 5 | default: boolean; 6 | description?: string; 7 | emoji?: ReactionType; 8 | label: string; 9 | value: string; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ITextInput.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { TextInputStyle } from "./TextInputStyle"; 3 | 4 | export interface ITextInput { 5 | customId: string; 6 | label: string; 7 | maxLength: number | null; 8 | minLength: number | null; 9 | placeholder: string | null; 10 | required: boolean | null; 11 | style: TextInputStyle; 12 | value: string | null; 13 | } 14 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/IUnknownComponent.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IUnknownComponent { 4 | componentKind: number; 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/InviteTargetType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type InviteTargetType = "Stream" | "EmbeddedApplication"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageActivity.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { MessageActivityType } from "./MessageActivityType"; 3 | 4 | export interface MessageActivity { 5 | kind: MessageActivityType; 6 | partyId: string | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageActivityType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type MessageActivityType = 4 | | "Join" 5 | | "Spectate" 6 | | "Listen" 7 | | "JoinRequest"; 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageApplication.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface MessageApplication { 4 | coverImage: string | null; 5 | description: string; 6 | icon: string | null; 7 | id: string; 8 | name: string; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageFlags.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface MessageFlags { 4 | crossposted?: boolean; 5 | isCrosspost?: boolean; 6 | suppressEmbeds?: boolean; 7 | sourceMessageDeleted?: boolean; 8 | urgent?: boolean; 9 | hasThread?: boolean; 10 | ephemeral?: boolean; 11 | loading?: boolean; 12 | failedToMentionSomeRolesInThread?: boolean; 13 | } 14 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageReaction.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ReactionType } from "./ReactionType"; 3 | 4 | export interface MessageReaction { 5 | count: number; 6 | emoji: ReactionType; 7 | me: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MessageReference.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface MessageReference { 4 | channelId: string | null; 5 | guildId: string | null; 6 | messageId: string | null; 7 | failIfNotExists: boolean | null; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/MfaLevel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type MfaLevel = "None" | "Elevated"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/NsfwLevel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type NsfwLevel = "Default" | "Explicit" | "Safe" | "AgeRestricted"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/PartialMember.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface PartialMember { 4 | deaf: boolean; 5 | joinedAt: number; 6 | mute: boolean; 7 | nick: string | null; 8 | premiumSince: number | null; 9 | roles: Array; 10 | communicationDisabledUntil: number | null; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/PermissionOverwriteType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type PermissionOverwriteType = "Member" | "Role"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/PremiumTier.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type PremiumTier = "None" | "Tier1" | "Tier2" | "Tier3"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ReactionType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ReactionType = { 4 | animated: boolean; 5 | id: string; 6 | name: string | null; 7 | } | { unicode: string }; 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/Role.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { RoleTags } from "./RoleTags"; 3 | 4 | export interface Role { 5 | color: number; 6 | hoist: boolean; 7 | icon: string | null; 8 | id: string; 9 | managed: boolean; 10 | mentionable: boolean; 11 | name: string; 12 | permissionsRaw: string; 13 | position: number; 14 | tags: RoleTags | null; 15 | unicodeEmoji: string | null; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/RoleTags.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface RoleTags { 4 | botId: string | null; 5 | integrationId: string | null; 6 | premiumSubscriber: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/SelectDefaultValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type SelectDefaultValue = { "kind": "User"; "value": string } | { 4 | "kind": "Role"; 5 | "value": string; 6 | } | { "kind": "Channel"; "value": string }; 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/SelectMenuType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type SelectMenuType = 4 | | "Text" 5 | | "User" 6 | | "Role" 7 | | "Mentionable" 8 | | "Channel"; 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/SendEmoji.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type SendEmoji = { id: string; name?: string } | { unicode: string }; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/SystemChannelFlags.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface SystemChannelFlags { 4 | suppressJoinNotifications: boolean; 5 | suppressPremiumSubscriptions: boolean; 6 | suppressGuildReminderNotifications: boolean; 7 | suppressJoinNotificationReplies: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/TextInputStyle.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type TextInputStyle = "Short" | "Paragraph"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/ThreadMetadata.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ThreadMetadata { 4 | archived: boolean; 5 | autoArchiveDurationMinutes: number; 6 | archiveTimestamp: number; 7 | invitable: boolean | null; 8 | locked: boolean; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/VerificationLevel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type VerificationLevel = "None" | "Low" | "Medium" | "High" | "VeryHigh"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/discord/VideoQualityMode.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type VideoQualityMode = "Auto" | "Full"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/image/SupportedEncodeImageFormat.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type SupportedEncodeImageFormat = "png" | "jpeg" | "gif" | "webp"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/image/SupportedImageFormat.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type SupportedImageFormat = 4 | | "png" 5 | | "jpeg" 6 | | "gif" 7 | | "webp" 8 | | "pnm" 9 | | "tiff" 10 | | "tga" 11 | | "bmp" 12 | | "ico" 13 | | "hdr" 14 | | "openexr" 15 | | "qoi" 16 | | "avif"; 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/image/index.ts: -------------------------------------------------------------------------------- 1 | // generated index file using gen-index.bash 2 | export * from './SupportedEncodeImageFormat' 3 | export * from './SupportedImageFormat' 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/index.ts: -------------------------------------------------------------------------------- 1 | // generated index file using gen-index.bash 2 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/AllowedMentions.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { MentionParseTypes } from "./MentionParseTypes"; 3 | 4 | export interface AllowedMentions { 5 | parse: Array; 6 | users: Array; 7 | roles: Array; 8 | repliedUser: boolean; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/AutocompleteCallbackData.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandOptionChoice } from "./CommandOptionChoice"; 3 | 4 | export interface AutocompleteCallbackData { 5 | choices: Array; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/Ban.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUser } from "./IUser"; 3 | 4 | export interface IBan { 5 | reason: string | null; 6 | user: IUser; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CategoryChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 3 | 4 | export interface ICategoryChannel { 5 | id: string; 6 | kind: "Category"; 7 | name: string; 8 | permissionOverwrites: Array; 9 | position: number; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ClientHttpRequest.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ClientHttpRequest { 4 | path: string; 5 | method: string; 6 | headers: Record; 7 | scriptId?: number; 8 | bodyResourceId?: number; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ClientHttpResponse.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ClientHttpResponse { 4 | headers: Record; 5 | statusCode: number; 6 | bodyResourceId: number; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/Command.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandOption } from "./CommandOption"; 3 | import type { CommandType } from "./CommandType"; 4 | 5 | export interface Command { 6 | name: string; 7 | description: string; 8 | options: Array; 9 | group?: string; 10 | subGroup?: string; 11 | kind: CommandType; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandGroup.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandSubGroup } from "./CommandSubGroup"; 3 | 4 | export interface CommandGroup { 5 | name: string; 6 | description: string; 7 | subGroups: Array; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandInteraction.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandInteractionOption } from "./CommandInteractionOption"; 3 | import type { CommandType } from "./CommandType"; 4 | import type { IMember } from "./Member"; 5 | import type { InteractionDataMap } from "./InteractionDataMaps"; 6 | 7 | export interface CommandInteraction { 8 | channelId: string; 9 | id: string; 10 | member: IMember; 11 | token: string; 12 | name: string; 13 | parentName: string | null; 14 | parentParentName: string | null; 15 | options: Array; 16 | dataMap: InteractionDataMap; 17 | kind: CommandType; 18 | targetId: string | null; 19 | isAutocomplete: boolean; 20 | } 21 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandInteractionOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandInteractionOptionValue } from "./CommandInteractionOptionValue"; 3 | 4 | export interface CommandInteractionOption { 5 | name: string; 6 | value: CommandInteractionOptionValue; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandInteractionOptionValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandOptionType } from "./CommandOptionType"; 3 | 4 | export type CommandInteractionOptionValue = 5 | | { "kind": "string"; value: string } 6 | | { "kind": "integer"; value: number } 7 | | { "kind": "boolean"; value: boolean } 8 | | { "kind": "user"; value: string } 9 | | { "kind": "channel"; value: string } 10 | | { "kind": "role"; value: string } 11 | | { "kind": "mentionable"; value: string } 12 | | { "kind": "number"; value: number } 13 | | { "kind": "attachment"; value: string } 14 | | { "kind": "focused"; value: string; option_kind: CommandOptionType }; 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandOptionType } from "./CommandOptionType"; 3 | import type { ExtraCommandOptions } from "./ExtraCommandOptions"; 4 | 5 | export interface CommandOption { 6 | name: string; 7 | description: string; 8 | kind: CommandOptionType; 9 | required: boolean; 10 | extraOptions: ExtraCommandOptions; 11 | autocompleteEnabled: boolean; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandOptionChoice.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandOptionChoiceValue } from "./CommandOptionChoiceValue"; 3 | 4 | export interface CommandOptionChoice { 5 | name: string; 6 | value: CommandOptionChoiceValue; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandOptionChoiceValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type CommandOptionChoiceValue = string | number; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandOptionType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type CommandOptionType = 4 | | "String" 5 | | "Integer" 6 | | "Boolean" 7 | | "User" 8 | | "Channel" 9 | | "Role" 10 | | "Mentionable" 11 | | "Number" 12 | | "Attachment"; 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandSubGroup.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface CommandSubGroup { 4 | name: string; 5 | description: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CommandType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type CommandType = "Chat" | "User" | "Message"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ConsoleLogLevel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ConsoleLogLevel = "log" | "warn" | "error"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ConsoleLogMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ConsoleLogLevel } from "./ConsoleLogLevel"; 3 | 4 | export interface ConsoleLogMessage { 5 | fileName?: string; 6 | lineNumber?: number; 7 | colNumber?: number; 8 | message: string; 9 | level: ConsoleLogLevel; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateBanFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface CreateBanFields { 4 | auditLogReason?: string; 5 | deleteMessageDays?: number; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateChannelMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 3 | 4 | export interface OpCreateChannelMessage { 5 | channelId: string; 6 | fields: OpCreateMessageFields; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateFollowUpMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { MessageFlags } from "../discord/MessageFlags"; 3 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 4 | 5 | export interface OpCreateFollowUpMessage { 6 | interactionToken: string; 7 | fields: OpCreateMessageFields; 8 | flags: MessageFlags | null; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateMessageFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { AllowedMentions } from "./AllowedMentions"; 3 | import type { Embed } from "../discord/Embed"; 4 | import type { IComponent } from "../discord/IComponent"; 5 | import type { OpCreateMessageAttachment } from "./OpCreateMessageAttachment"; 6 | 7 | export interface OpCreateMessageFields { 8 | content?: string; 9 | embeds?: Array; 10 | allowedMentions?: AllowedMentions; 11 | components?: Array; 12 | replyToMessageId?: string; 13 | attachments?: Array; 14 | } 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateRoleFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpCreateRoleFields { 4 | color?: number; 5 | hoist?: boolean; 6 | mentionable?: boolean; 7 | name?: string; 8 | permissions?: string; 9 | unicodeEmoji?: string; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CreateScheduledTask.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface CreateScheduledTask { 4 | pluginId: string | null; 5 | namespace: string; 6 | uniqueKey?: string; 7 | data: any; 8 | executeAt: number; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/CustomEmoji.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface CustomEmoji { 4 | animated: boolean; 5 | available: boolean; 6 | id: string; 7 | managed: boolean; 8 | name: string; 9 | requireColons: boolean; 10 | roles: Array; 11 | createdByUserId: string | null; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/DeleteMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpDeleteMessage { 4 | channelId: string; 5 | messageId: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/DeleteMessagesBulk.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpDeleteMessagesBulk { 4 | channelId: string; 5 | messageIds: Array; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/DiscordWebhook.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUser } from "./IUser"; 3 | import type { WebhookChannel } from "./WebhookChannel"; 4 | import type { WebhookGuild } from "./WebhookGuild"; 5 | import type { WebhookType } from "./WebhookType"; 6 | 7 | export interface DiscordWebhook { 8 | id: string; 9 | applicationId: string | null; 10 | avatar: string | null; 11 | channelId: string; 12 | guildId: string | null; 13 | kind: WebhookType; 14 | name: string | null; 15 | sourceChannel: WebhookChannel | null; 16 | sourceGuild: WebhookGuild | null; 17 | token: string | null; 18 | url: string | null; 19 | user: IUser | null; 20 | } 21 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/EditChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 3 | import type { VideoQualityMode } from "../discord/VideoQualityMode"; 4 | 5 | export interface IEditChannel { 6 | bitrate?: number; 7 | name?: string; 8 | nsfw?: boolean; 9 | parentId?: string | null; 10 | permissionOverwrites?: Array; 11 | position?: number; 12 | rateLimitPerUser?: number; 13 | topic?: string; 14 | userLimit?: number; 15 | videoQualityMode?: VideoQualityMode; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/EditChannelMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 3 | 4 | export interface OpEditChannelMessage { 5 | channelId: string; 6 | messageId: string; 7 | fields: OpCreateMessageFields; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/EventMemberRemove.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUser } from "./IUser"; 3 | 4 | export interface IEventMemberRemove { 5 | guildId: string; 6 | user: IUser; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/EventMessageReactionAdd.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IMember } from "./Member"; 3 | import type { ReactionType } from "../discord/ReactionType"; 4 | 5 | export interface IEventMessageReactionAdd { 6 | channelId: string; 7 | messageId: string; 8 | emoji: ReactionType; 9 | member: IMember; 10 | userId: string; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/EventMessageUpdate.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { Attachment } from "../discord/Attachment"; 3 | import type { Embed } from "../discord/Embed"; 4 | import type { IUser } from "./IUser"; 5 | import type { IUserMention } from "./UserMention"; 6 | import type { MessageType } from "../discord/MessageType"; 7 | 8 | export interface IEventMessageUpdate { 9 | attachments?: Array; 10 | author?: IUser; 11 | channelId: string; 12 | content: string | null; 13 | editedTimestamp?: number; 14 | embeds?: Array; 15 | guildId?: string; 16 | id: string; 17 | kind?: MessageType; 18 | mentionEveryone?: boolean; 19 | mentionRoles?: Array; 20 | mentions?: Array; 21 | pinned?: boolean; 22 | timestamp?: number; 23 | tts?: boolean; 24 | } 25 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ExtraCommandOptions.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "../discord/ChannelType"; 3 | import type { CommandOptionChoice } from "./CommandOptionChoice"; 4 | 5 | export interface ExtraCommandOptions { 6 | minValue?: number; 7 | maxValue?: number; 8 | channelTypes?: Array; 9 | choices?: Array; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/GetGuildTasksFilter.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ScopeSelector } from "./ScopeSelector"; 3 | 4 | export interface GetGuildTasksFilter { 5 | scope: ScopeSelector; 6 | namespace: string | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/GetMessages.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpGetMessages { 4 | channelId: string; 5 | after?: string; 6 | before?: string; 7 | limit?: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/GetReactions.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { SendEmoji } from "../discord/SendEmoji"; 3 | 4 | export interface GetReactionsFields { 5 | emoji: SendEmoji; 6 | after?: string; 7 | limit?: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/GuildChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ICategoryChannel } from "./CategoryChannel"; 3 | import type { INewsThread } from "./NewsThread"; 4 | import type { IPrivateThread } from "./PrivateThread"; 5 | import type { IPublicThread } from "./PublicThread"; 6 | import type { ITextChannel } from "./TextChannel"; 7 | import type { IVoiceChannel } from "./VoiceChannel"; 8 | 9 | export type InternalGuildChannel = 10 | | ICategoryChannel 11 | | INewsThread 12 | | IPrivateThread 13 | | IPublicThread 14 | | ITextChannel 15 | | IVoiceChannel 16 | | IVoiceChannel 17 | | ITextChannel 18 | | ITextChannel; 19 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ICreateChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "../discord/ChannelType"; 3 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 4 | 5 | export interface ICreateChannel { 6 | name: string; 7 | kind?: ChannelType; 8 | bitrate?: number; 9 | nsfw?: boolean; 10 | parentId?: string; 11 | permissionOverwrites?: Array; 12 | position?: number; 13 | rateLimitPerUser?: number; 14 | topic?: string; 15 | userLimit?: number; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ICreateForumThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 3 | 4 | export interface ICreateForumThread { 5 | channelId: string; 6 | name: string; 7 | tagIds?: Array; 8 | autoArchiveDurationMinutes?: number; 9 | rateLimitPerUser?: number; 10 | message: OpCreateMessageFields; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ICreateInviteFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { InviteTargetType } from "../discord/InviteTargetType"; 3 | 4 | export interface ICreateInviteFields { 5 | max_age?: number; 6 | max_uses?: number; 7 | temporary?: boolean; 8 | target_application_id?: string; 9 | target_user_id?: string; 10 | target_type?: InviteTargetType; 11 | unique?: boolean; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ICreateThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "../discord/ChannelType"; 3 | 4 | export interface ICreateThread { 5 | channelId: string; 6 | autoArchiveDurationMinutes?: number; 7 | invitable?: boolean; 8 | kind: ChannelType; 9 | name: string; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ICreateThreadFromMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ICreateThreadFromMessage { 4 | channelId: string; 5 | messageId: string; 6 | autoArchiveDurationMinutes?: number; 7 | name: string; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEditGuildChannelPosition.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IEditGuildChannelPosition { 4 | channelId: string; 5 | position: number; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEventInviteCreate.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IInviteTargetUser } from "../discord/IInviteTargetUser"; 3 | import type { IUser } from "./IUser"; 4 | import type { InviteTargetType } from "../discord/InviteTargetType"; 5 | 6 | export interface IEventInviteCreate { 7 | channelId: string; 8 | code: string; 9 | createdAt: number; 10 | inviter?: IUser; 11 | maxAge: number; 12 | maxUses: number; 13 | targetUserType?: InviteTargetType; 14 | targetUser?: IInviteTargetUser; 15 | temporary: boolean; 16 | uses: number; 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEventInviteDelete.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IEventInviteDelete { 4 | channelId: string; 5 | code: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEventThreadListSync.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IThreadMember } from "./ThreadMember"; 3 | import type { InternalGuildChannel } from "./GuildChannel"; 4 | 5 | export interface IEventThreadListSync { 6 | channelIds: Array; 7 | members: Array; 8 | threads: Array; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEventThreadMembersUpdate.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IThreadMember } from "./ThreadMember"; 3 | 4 | export interface IEventThreadMembersUpdate { 5 | addedMembers: Array; 6 | id: string; 7 | memberCount: number; 8 | removedMemberIds: Array; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IEventVoiceStateUpdate.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IVoiceState } from "./IVoiceState"; 3 | 4 | export interface IEventVoiceStateUpdate { 5 | new: IVoiceState; 6 | old: IVoiceState | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IForumThreadResponse.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IMessage } from "./IMessage"; 3 | import type { InternalGuildChannel } from "./GuildChannel"; 4 | 5 | export interface IForumThreadResponse { 6 | message: IMessage; 7 | channel: InternalGuildChannel; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IInvite.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IInviteChannel } from "../discord/IInviteChannel"; 3 | import type { IInviteGuild } from "../discord/IInviteGuild"; 4 | import type { IUser } from "./IUser"; 5 | import type { InviteTargetType } from "../discord/InviteTargetType"; 6 | 7 | export interface IInvite { 8 | approximateMemberCount?: number; 9 | approximatePresenceCount?: number; 10 | channel: IInviteChannel | null; 11 | code: string; 12 | createdAt?: number; 13 | expiresAt?: number; 14 | guild?: IInviteGuild; 15 | inviter?: IUser; 16 | maxAge?: number; 17 | maxUses?: number; 18 | targetType?: InviteTargetType; 19 | targetUser?: IUser; 20 | temporary?: boolean; 21 | uses?: number; 22 | } 23 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IListThreadMembersRequest.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IListThreadMembersRequest { 4 | channelId: string; 5 | afterUserId?: string; 6 | limit?: number; 7 | withMember?: boolean; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IListThreadsRequest.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IListThreadsRequest { 4 | channelId: string; 5 | before?: number; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IModalCallbackData.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IComponent } from "../discord/IComponent"; 3 | 4 | export interface IModalCallbackData { 5 | title: string; 6 | customId: string; 7 | components: Array; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IModalInteraction.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IMember } from "./Member"; 3 | import type { IMessage } from "./IMessage"; 4 | import type { IModalInteractionDataComponent } from "./IModalInteractionDataComponent"; 5 | 6 | export interface IModalInteraction { 7 | channelId: string; 8 | guildLocale: string | null; 9 | id: string; 10 | locale: string; 11 | member: IMember; 12 | message: IMessage | null; 13 | token: string; 14 | customId: string; 15 | values: Array; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IModalInteractionDataComponent.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ComponentType } from "../discord/ComponentType"; 3 | 4 | export interface IModalInteractionDataComponent { 5 | customId: string; 6 | kind: ComponentType; 7 | value: string; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ISelfThreadMember.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ISelfThreadMember { 4 | joinTimestamp: number; 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IThreadsListing.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IThreadMember } from "./ThreadMember"; 3 | import type { InternalGuildChannel } from "./GuildChannel"; 4 | 5 | export interface IThreadsListing { 6 | hasMore?: boolean; 7 | members: Array; 8 | threads: Array; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IUpdateThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IUpdateThread { 4 | channelId: string; 5 | tagIds?: Array; 6 | archived?: boolean; 7 | autoArchiveDurationMinutes?: number; 8 | invitable?: boolean; 9 | locked?: boolean; 10 | name?: string; 11 | rateLimitPerUser?: number; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IUser.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUserFlags } from "./IUserFlags"; 3 | import type { PremiumType } from "./PremiumType"; 4 | 5 | export interface IUser { 6 | avatar: string | null; 7 | bot: boolean; 8 | discriminator: string; 9 | id: string; 10 | locale: string | null; 11 | username: string; 12 | globalName: string | null; 13 | premiumType: PremiumType | null; 14 | publicFlags: IUserFlags | null; 15 | system: boolean | null; 16 | banner: string | null; 17 | accentColor: number | null; 18 | } 19 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IUserFlags.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IUserFlags { 4 | staff: boolean; 5 | partner: boolean; 6 | hypesquad: boolean; 7 | bugHunterLevel1: boolean; 8 | hypesquadOnlineHouse1: boolean; 9 | hypesquadOnlineHouse2: boolean; 10 | hypesquadOnlineHouse3: boolean; 11 | premiumEarlySupporter: boolean; 12 | teamPseudoUser: boolean; 13 | bugHunterLevel2: boolean; 14 | verifiedBot: boolean; 15 | verifiedDeveloper: boolean; 16 | certifiedModerator: boolean; 17 | botHttpInteractions: boolean; 18 | } 19 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IVoiceState.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IMember } from "./Member"; 3 | 4 | export interface IVoiceState { 5 | channelId: string | null; 6 | deaf: boolean; 7 | guildId: string; 8 | member?: IMember; 9 | mute: boolean; 10 | selfDeaf: boolean; 11 | selfMute: boolean; 12 | selfStream: boolean; 13 | selfVideo: boolean; 14 | sessionId: string; 15 | suppress: boolean; 16 | userId: string; 17 | requestToSpeakTimestamp: number | null; 18 | } 19 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ImageProperties.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { SupportedImageFormat } from "../image/SupportedImageFormat"; 3 | 4 | export interface ImageProperties { 5 | formatName: SupportedImageFormat; 6 | width: number; 7 | height: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/Interaction.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { CommandInteraction } from "./CommandInteraction"; 3 | import type { IModalInteraction } from "./IModalInteraction"; 4 | import type { MessageComponentInteraction } from "./MessageComponentInteraction"; 5 | 6 | export type Interaction = 7 | | { "kind": "Command" } & CommandInteraction 8 | | { "kind": "MessageComponent" } & MessageComponentInteraction 9 | | { "kind": "ModalSubmit" } & IModalInteraction; 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionCallback.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { InteractionResponse } from "./InteractionResponse"; 3 | 4 | export interface InteractionCallback { 5 | interactionId: string; 6 | interactionToken: string; 7 | data: InteractionResponse; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionCallbackData.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { MessageFlags } from "../discord/MessageFlags"; 3 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 4 | 5 | export interface InteractionCallbackData { 6 | fields: OpCreateMessageFields; 7 | flags: MessageFlags | null; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ChannelType } from "../discord/ChannelType"; 3 | import type { ThreadMetadata } from "../discord/ThreadMetadata"; 4 | 5 | export interface InteractionPartialChannel { 6 | id: string; 7 | kind: ChannelType; 8 | name: string; 9 | parentId?: string; 10 | permissionsRaw: string; 11 | threadMetadata?: ThreadMetadata; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionDataMaps.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { Attachment } from "../discord/Attachment"; 3 | import type { IMessage } from "./IMessage"; 4 | import type { IUser } from "./IUser"; 5 | import type { InteractionPartialChannel } from "./InteractionChannel"; 6 | import type { InteractionPartialMember } from "./InteractionPartialMember"; 7 | import type { Role } from "../discord/Role"; 8 | 9 | export interface InteractionDataMap { 10 | channels: Record; 11 | members: Record; 12 | messages: Record; 13 | roles: Record; 14 | users: Record; 15 | attachments: Record; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionPartialMember.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface InteractionPartialMember { 4 | joinedAt: number; 5 | nick: string | null; 6 | premiumSince?: number; 7 | roles: Array; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/InteractionResponse.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { AutocompleteCallbackData } from "./AutocompleteCallbackData"; 3 | import type { IModalCallbackData } from "./IModalCallbackData"; 4 | import type { InteractionCallbackData } from "./InteractionCallbackData"; 5 | 6 | export type InteractionResponse = 7 | | { "kind": "Pong" } 8 | | { "kind": "ChannelMessageWithSource" } & InteractionCallbackData 9 | | { "kind": "DeferredChannelMessageWithSource" } & InteractionCallbackData 10 | | { "kind": "DeferredUpdateMessage" } 11 | | { "kind": "UpdateMessage" } & InteractionCallbackData 12 | | { "kind": "Modal" } & IModalCallbackData 13 | | { "kind": "Autocomplete" } & AutocompleteCallbackData; 14 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IntervalTimer.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IntervalType } from "./IntervalType"; 3 | 4 | export interface IntervalTimer { 5 | name: string; 6 | interval: IntervalType; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IntervalTimerEvent.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IntervalTimerEvent { 4 | name: string; 5 | pluginId: string | null; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/IntervalType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type IntervalType = { "minutes": number } | { "cron": string }; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/Member.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUser } from "./IUser"; 3 | 4 | export interface IMember { 5 | deaf: boolean; 6 | joinedAt: number; 7 | mute: boolean; 8 | nick: string | null; 9 | pending: boolean; 10 | premiumSince: number | null; 11 | roles: Array; 12 | communicationDisabledUntil: number | null; 13 | user: IUser; 14 | } 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/MentionParseTypes.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type MentionParseTypes = "Everyone" | "Roles" | "Users"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/MessageComponentInteraction.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ComponentType } from "../discord/ComponentType"; 3 | import type { IMember } from "./Member"; 4 | import type { IMessage } from "./IMessage"; 5 | import type { InteractionDataMap } from "./InteractionDataMaps"; 6 | 7 | export interface MessageComponentInteraction { 8 | channelId: string; 9 | guildLocale: string | null; 10 | id: string; 11 | locale: string; 12 | member: IMember; 13 | message: IMessage; 14 | token: string; 15 | resolved: InteractionDataMap | null; 16 | customId: string; 17 | componentType: ComponentType; 18 | values: Array; 19 | } 20 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/NewsThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ISelfThreadMember } from "./ISelfThreadMember"; 3 | import type { ThreadMetadata } from "../discord/ThreadMetadata"; 4 | 5 | export interface INewsThread { 6 | defaultAutoArchiveDurationMinutes: number | null; 7 | id: string; 8 | kind: "NewsThread"; 9 | member: ISelfThreadMember | null; 10 | memberCount: number; 11 | messageCount: number; 12 | name: string; 13 | ownerId: string | null; 14 | parentId: string | null; 15 | rateLimitPerUser: number | null; 16 | threadMetadata: ThreadMetadata; 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpCreateEmoji.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpCreateEmoji { 4 | name: string; 5 | data: string; 6 | roles: Array | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpCreateMessageAttachment.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpCreateMessageAttachment { 4 | description: string | null; 5 | dataB64: string; 6 | filename: string; 7 | id: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpCreateWebhook.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpCreateWebhook { 4 | icon: string | null; 5 | name: string; 6 | channel_id: string; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpEditWebhook.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpEditWebhook { 4 | webhook_id: string; 5 | icon?: string | null; 6 | channel_id: string | null; 7 | name: string | null; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpEditWebhookWithToken.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpEditWebhookWithToken { 4 | webhook_id: string; 5 | icon?: string | null; 6 | name: string | null; 7 | token: string; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpExecuteWebhook.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 3 | 4 | export interface OpExecuteWebhook { 5 | webhook_id: string; 6 | token: string; 7 | avatar_url: string | null; 8 | username: string | null; 9 | fields: OpCreateMessageFields; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpUpdateEmoji.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpUpdateEmoji { 4 | id: string; 5 | name: string | null; 6 | roles: Array | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpUpdateWebhookMessage.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpCreateMessageFields } from "./CreateMessageFields"; 3 | 4 | export interface OpUpdateWebhookMessage { 5 | webhook_id: string; 6 | token: string; 7 | message_id: string; 8 | fields: OpCreateMessageFields; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpWebhookMessageSpecifier.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpWebhookMessageSpecifier { 4 | webhook_id: string; 5 | token: string; 6 | message_id: string; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/OpWebhookSpecifier.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpWebhookSpecifier { 4 | webhook_id: string; 5 | token: string | null; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/PremiumType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type PremiumType = "none" | "nitroclassic" | "nitro" | "nitrobasic"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/PrivateThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 3 | import type { ISelfThreadMember } from "./ISelfThreadMember"; 4 | import type { ThreadMetadata } from "../discord/ThreadMetadata"; 5 | 6 | export interface IPrivateThread { 7 | defaultAutoArchiveDurationMinutes: number | null; 8 | id: string; 9 | invitable: boolean | null; 10 | kind: "PrivateThread"; 11 | member: ISelfThreadMember | null; 12 | memberCount: number; 13 | messageCount: number; 14 | name: string; 15 | ownerId: string | null; 16 | parentId: string | null; 17 | permissionOverwrites: Array; 18 | rateLimitPerUser: number | null; 19 | threadMetadata: ThreadMetadata; 20 | } 21 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/PublicThread.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { ISelfThreadMember } from "./ISelfThreadMember"; 3 | import type { ThreadMetadata } from "../discord/ThreadMetadata"; 4 | 5 | export interface IPublicThread { 6 | defaultAutoArchiveDurationMinutes: number | null; 7 | id: string; 8 | kind: "PublicThread"; 9 | member: ISelfThreadMember | null; 10 | memberCount: number; 11 | messageCount: number; 12 | name: string; 13 | ownerId: string | null; 14 | parentId: string | null; 15 | rateLimitPerUser: number | null; 16 | threadMetadata: ThreadMetadata; 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ScheduledTask.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface ScheduledTask { 4 | id: number; 5 | namespace: string; 6 | pluginId: string | null; 7 | key?: string; 8 | executeAt: number; 9 | data: unknown; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ScopeSelector.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type ScopeSelector = { "kind": "All" } | { "kind": "Guild" } | { 4 | "kind": "Plugin"; 5 | plugin_id: string; 6 | }; 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ScriptMeta.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { Command } from "./Command"; 3 | import type { CommandGroup } from "./CommandGroup"; 4 | import type { IntervalTimer } from "./IntervalTimer"; 5 | import type { SettingsOptionDefinition } from "./SettingOptionDefinition"; 6 | import type { TaskBucketId } from "./ScriptTaskBucketId"; 7 | 8 | export interface ScriptMeta { 9 | description: string; 10 | scriptId: number; 11 | pluginId: string | null; 12 | commands: Array; 13 | commandGroups: Array; 14 | intervalTimers: Array; 15 | taskBuckets: Array; 16 | settings: Array; 17 | } 18 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ScriptTaskBucketId.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface TaskBucketId { 4 | name: string; 5 | pluginId: string | null; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingOptionDefinition.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { SettingsOption } from "./SettingsOption"; 3 | import type { SettingsOptionList } from "./SettingsOptionList"; 4 | 5 | export type SettingsOptionDefinition = { 6 | "kind": "Option"; 7 | "data": SettingsOption; 8 | } | { "kind": "List"; "data": SettingsOptionList }; 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingsNumberSelectOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface SettingsNumberSelectOption { 4 | label: string; 5 | value: number; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingsOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { SettingsOptionType } from "./SettingsOptionType"; 3 | 4 | export interface SettingsOption { 5 | name: string; 6 | label: string; 7 | description: string; 8 | required: boolean; 9 | defaultValue: any; 10 | kind: SettingsOptionType; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingsOptionList.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { SettingsOption } from "./SettingsOption"; 3 | 4 | export interface SettingsOptionList { 5 | name: string; 6 | label: string; 7 | description: string; 8 | required: boolean; 9 | defaultValue: any; 10 | template: Array; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingsOptionValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface SettingsOptionValue { 4 | name: string; 5 | value: any; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/SettingsStringSelectOption.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface SettingsStringSelectOption { 4 | label: string; 5 | value: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucket.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpStorageBucket { 4 | name: string; 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketEntry.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpStorageBucketValue } from "./StorageBucketValue"; 3 | 4 | export interface OpStorageBucketEntry { 5 | pluginId: string | null; 6 | bucketName: string; 7 | key: string; 8 | value: OpStorageBucketValue; 9 | expiresAt: number | null; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketEntryId.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpStorageBucketEntryId { 4 | bucketName: string; 5 | key: string; 6 | pluginId: string | null; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketIncr.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpStorageBucketIncr { 4 | bucketName: string; 5 | key: string; 6 | pluginId: string | null; 7 | amount: number; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketList.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpStorageBucketList { 4 | bucketName: string; 5 | keyPattern?: string; 6 | after?: string; 7 | limit?: number; 8 | pluginId: string | null; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketListOrder.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type OpStorageBucketListOrder = "Ascending" | "Descending"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketSetCondition.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type OpStorageBucketSetCondition = "IfExists" | "IfNotExists"; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketSetIf.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpStorageBucketSetCondition } from "./StorageBucketSetCondition"; 3 | import type { OpStorageBucketValue } from "./StorageBucketValue"; 4 | 5 | export interface OpStorageBucketSetIf { 6 | bucketName: string; 7 | key: string; 8 | value: OpStorageBucketValue; 9 | ttl?: number; 10 | cond: OpStorageBucketSetCondition; 11 | pluginId: string | null; 12 | } 13 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketSetValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpStorageBucketValue } from "./StorageBucketValue"; 3 | 4 | export interface OpStorageBucketSetValue { 5 | bucketName: string; 6 | key: string; 7 | value: OpStorageBucketValue; 8 | ttl?: number; 9 | pluginId: string | null; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketSortedList.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { OpStorageBucketListOrder } from "./StorageBucketListOrder"; 3 | 4 | export interface OpStorageBucketSortedList { 5 | bucketName: string; 6 | pluginId: string | null; 7 | offset?: number; 8 | limit?: number; 9 | order: OpStorageBucketListOrder; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/StorageBucketValue.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type OpStorageBucketValue = { "json": any } | { "double": number }; 4 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/TextChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 3 | 4 | export interface ITextChannel { 5 | id: string; 6 | kind: "Text" | "News" | "Forum" | "GuildDirectory"; 7 | lastPinTimestamp: number | null; 8 | name: string; 9 | nsfw: boolean; 10 | parentId: string | null; 11 | permissionOverwrites: Array; 12 | position: number; 13 | rateLimitPerUser: number | null; 14 | topic: string | null; 15 | } 16 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/ThreadMember.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IMember } from "./Member"; 3 | 4 | export interface IThreadMember { 5 | id: string | null; 6 | joinTimestamp: number; 7 | member: IMember | null; 8 | userId: string | null; 9 | } 10 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/UnknownChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface IUnknownChannel { 4 | id: string; 5 | kind: { Unknown: number }; 6 | unknownKindId: number; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/UpdateGuildMemberFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface UpdateGuildMemberFields { 4 | channelId?: string | null; 5 | deaf?: boolean; 6 | mute?: boolean; 7 | nick?: string | null; 8 | roles?: string[]; 9 | communicationDisabledUntil?: number | null; 10 | } 11 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/UpdateRoleFields.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface OpUpdateRoleFields { 4 | roleId: string; 5 | color?: number | null; 6 | hoist?: boolean; 7 | mentionable?: boolean; 8 | name?: string | null; 9 | permissions?: string; 10 | unicodeEmoji?: string; 11 | } 12 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/UpdateRolePosition.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface UpdateRolePosition { 4 | roleId: string; 5 | position: number; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/UserMention.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IUser } from "./IUser"; 3 | import type { PartialMember } from "../discord/PartialMember"; 4 | 5 | export interface IUserMention { 6 | user: IUser; 7 | member: PartialMember | null; 8 | } 9 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/VoiceChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | import type { IPermissionOverwrite } from "../discord/IPermissionOverwrite"; 3 | import type { VideoQualityMode } from "../discord/VideoQualityMode"; 4 | 5 | export interface IVoiceChannel { 6 | bitrate: number; 7 | id: string; 8 | kind: "Voice" | "StageVoice"; 9 | name: string; 10 | parentId: string | null; 11 | permissionOverwrites: Array; 12 | position: number; 13 | rtcRegion: string | null; 14 | userLimit: number | null; 15 | videoQualityMode: VideoQualityMode | null; 16 | } 17 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/WebhookChannel.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface WebhookChannel { 4 | id: string; 5 | name: string; 6 | } 7 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/WebhookGuild.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export interface WebhookGuild { 4 | icon: string | null; 5 | id: string; 6 | name: string; 7 | } 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/generated/internal/WebhookType.ts: -------------------------------------------------------------------------------- 1 | // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. 2 | 3 | export type WebhookType = 4 | | "Incoming" 5 | | "ChannelFollower" 6 | | "Application" 7 | | "Unknown"; 8 | -------------------------------------------------------------------------------- /components/runtime/src/ts/globals/lib.core_util.d.ts: -------------------------------------------------------------------------------- 1 | import { console as _console } from '../core_util'; 2 | 3 | declare global { 4 | const console: { 5 | log: typeof _console.log, 6 | error: typeof _console.error, 7 | warn: typeof _console.warn, 8 | output: typeof _console.output, 9 | } 10 | } -------------------------------------------------------------------------------- /components/runtime/src/ts/globals/script_globals.d.ts: -------------------------------------------------------------------------------- 1 | import { Script } from "../script" 2 | 3 | declare global { 4 | const script: Script; 5 | } -------------------------------------------------------------------------------- /components/runtime/src/ts/index.ts: -------------------------------------------------------------------------------- 1 | // Important: core_util provides globals so don't remove it 2 | export * from './core_util'; 3 | 4 | // export * from './timers'; 5 | export * from './commands'; 6 | export * from './eventsystem'; 7 | export * from './script'; 8 | export * as Settings from './settings'; 9 | export * from './storage'; 10 | export * from './httpclient'; 11 | export * from './scheduled_tasks'; 12 | export * from './image'; 13 | export * as Discord from './discord/index'; 14 | export * as Unstable from './unstable/index'; 15 | -------------------------------------------------------------------------------- /components/runtime/src/ts/internal_globals/lib.botloader_core_internal.d.ts: -------------------------------------------------------------------------------- 1 | declare let BotloaderCore: { 2 | dispatchEvent: (evt: { name: string, data: any }) => void; 3 | }; -------------------------------------------------------------------------------- /components/runtime/src/ts/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ts", 3 | "lockfileVersion": 3, 4 | "requires": true, 5 | "packages": { 6 | "": { 7 | "devDependencies": { 8 | "typescript": "^5.3.3" 9 | } 10 | }, 11 | "node_modules/typescript": { 12 | "version": "5.3.3", 13 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", 14 | "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", 15 | "dev": true, 16 | "bin": { 17 | "tsc": "bin/tsc", 18 | "tsserver": "bin/tsserver" 19 | }, 20 | "engines": { 21 | "node": ">=14.17" 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /components/runtime/src/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "devDependencies": { 3 | "typescript": "^5.3.3" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /components/runtime/src/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "ESNext", 4 | "noImplicitAny": true, 5 | "removeComments": false, 6 | "preserveConstEnums": true, 7 | "sourceMap": false, 8 | "target": "ESNext", 9 | "declaration": true, 10 | "strictNullChecks": true, 11 | "emitDeclarationOnly": true, 12 | "declarationDir": "typings/", 13 | "strict": true, 14 | "lib": [ 15 | "ESNext", 16 | ] 17 | }, 18 | "exclude": [ 19 | "typings" 20 | ], 21 | } -------------------------------------------------------------------------------- /components/runtime/src/ts/typedecls.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # cd to the script location 5 | cd "${0%/*}" 6 | 7 | if [ -d "./typings" ]; then 8 | rm -r typings 9 | fi 10 | 11 | npx tsc --build tsconfig.json 12 | 13 | # mkdir typings 14 | # mv *.d.ts typings 15 | 16 | cp -r globals typings -------------------------------------------------------------------------------- /components/runtime/src/ts/unstable/index.ts: -------------------------------------------------------------------------------- 1 | export * from './streams'; -------------------------------------------------------------------------------- /components/scheduler-worker-rpc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "scheduler-worker-rpc" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | runtime-models = { path = "../../components/runtime-models" } 10 | vm = { path = "../../components/vm" } 11 | common = { path = "../../components/common" } 12 | stores = { path = "../../components/stores" } 13 | guild-logger = { path = "../../components/guild-logger" } 14 | 15 | serde = { workspace = true } 16 | serde_json = { workspace = true } 17 | chrono = { workspace = true } 18 | tokio = { workspace = true } 19 | twilight-model = { workspace = true } 20 | -------------------------------------------------------------------------------- /components/simpleproto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "simpleproto" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | serde = {workspace = true} 10 | serde_json = {workspace = true} 11 | tokio = {workspace = true} 12 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-0878325bad1cf03218fb1e7211b655d9ada6984506ae2d693f9cd4dd07a9dc53.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "INSERT INTO images (uploaded_by, plugin_id, width, height, bytes, created_at)\n VALUES ($1, $2, $3, $4, $5, now())\n RETURNING id;", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "id", 9 | "type_info": "Uuid" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "Int8", 16 | "Int4", 17 | "Int4", 18 | "Bytea" 19 | ] 20 | }, 21 | "nullable": [ 22 | false 23 | ] 24 | }, 25 | "hash": "0878325bad1cf03218fb1e7211b655d9ada6984506ae2d693f9cd4dd07a9dc53" 26 | } 27 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-0d1be72462bf9559ba071f3b07b3d49006abff6585be3aa14b1d8ff1c2dde493.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM joined_guilds WHERE id = $1;", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "0d1be72462bf9559ba071f3b07b3d49006abff6585be3aa14b1d8ff1c2dde493" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-13a15115e1bfa6f1be2596d672a161a9999a049a06f219270bb4cc961c55796e.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT sum(pg_column_size(t)) FROM bucket_store t WHERE guild_id=$1 AND (expires_at IS NULL OR expires_at > now())", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "sum", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8" 15 | ] 16 | }, 17 | "nullable": [ 18 | null 19 | ] 20 | }, 21 | "hash": "13a15115e1bfa6f1be2596d672a161a9999a049a06f219270bb4cc961c55796e" 22 | } 23 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-13d98ab37ce4072ee51456048094a368a995205dd6b84867677aa1ae4690f12b.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT image_id from plugin_images WHERE plugin_id = $1 AND kind = $2", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "image_id", 9 | "type_info": "Uuid" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "Int4" 16 | ] 17 | }, 18 | "nullable": [ 19 | false 20 | ] 21 | }, 22 | "hash": "13d98ab37ce4072ee51456048094a368a995205dd6b84867677aa1ae4690f12b" 23 | } 24 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-15ceb47518db60042e48a5ce5b07d958cb05343655742628c3720ad730ee4171.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM interval_timers WHERE guild_id = $1;", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "15ceb47518db60042e48a5ce5b07d958cb05343655742628c3720ad730ee4171" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-1e4b5a68f95b2414cd99bbc8948a874a33acd581b6d16a0aaa237acec9896d5c.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM scheduled_tasks WHERE guild_id = $1 AND plugin_id = $2 AND (name = $3 OR $3 IS NULL )", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Int8", 10 | "Text" 11 | ] 12 | }, 13 | "nullable": [] 14 | }, 15 | "hash": "1e4b5a68f95b2414cd99bbc8948a874a33acd581b6d16a0aaa237acec9896d5c" 16 | } 17 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-28ba8c9f00ead06d759107bb246a004852ce954301f57e7a54cf54f3d01610ba.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT count(*) FROM web_sessions WHERE user_id = $1 AND kind = $2;", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "count", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "Int2" 16 | ] 17 | }, 18 | "nullable": [ 19 | null 20 | ] 21 | }, 22 | "hash": "28ba8c9f00ead06d759107bb246a004852ce954301f57e7a54cf54f3d01610ba" 23 | } 24 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-33159918d51423914dc53096f9e698094cf2ce677cf93ec85053ca211cbab848.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT count(*) FROM bucket_store WHERE guild_id = $1 AND plugin_id = $2 AND bucket = $3 AND key ILIKE $4 AND (expires_at IS NULL OR expires_at > now());", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "count", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "Int8", 16 | "Text", 17 | "Text" 18 | ] 19 | }, 20 | "nullable": [ 21 | null 22 | ] 23 | }, 24 | "hash": "33159918d51423914dc53096f9e698094cf2ce677cf93ec85053ca211cbab848" 25 | } 26 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-49a6466f558a6f6fd9c3c5fd330502113fabbf0276a0470b6c04ae0fffd551de.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT COUNT(*) FROM scheduled_tasks WHERE guild_id = $1;", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "count", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8" 15 | ] 16 | }, 17 | "nullable": [ 18 | null 19 | ] 20 | }, 21 | "hash": "49a6466f558a6f6fd9c3c5fd330502113fabbf0276a0470b6c04ae0fffd551de" 22 | } 23 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-4b3a008457563f1277ee8c141216a1c30402348dcddce46c79d51db243b38c20.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT guild_id, error_channel_id FROM guild_meta_configs\n WHERE guild_id = $1;", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "guild_id", 9 | "type_info": "Int8" 10 | }, 11 | { 12 | "ordinal": 1, 13 | "name": "error_channel_id", 14 | "type_info": "Int8" 15 | } 16 | ], 17 | "parameters": { 18 | "Left": [ 19 | "Int8" 20 | ] 21 | }, 22 | "nullable": [ 23 | false, 24 | false 25 | ] 26 | }, 27 | "hash": "4b3a008457563f1277ee8c141216a1c30402348dcddce46c79d51db243b38c20" 28 | } 29 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-5d4d48b2d4af04b9fc16575d08a7a9c8c09fa0d1be2d596c3d86f68f190f438b.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM plugin_images WHERE plugin_id = $1 AND image_id = $2", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Uuid" 10 | ] 11 | }, 12 | "nullable": [] 13 | }, 14 | "hash": "5d4d48b2d4af04b9fc16575d08a7a9c8c09fa0d1be2d596c3d86f68f190f438b" 15 | } 16 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-61977eb455a29c663ad3e344684e3dee119c43670b2443444bf7533cf51cb4a5.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "UPDATE images SET deleted_at = COALESCE(images.deleted_at, now()) WHERE plugin_id = $1 and id = $2", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Uuid" 10 | ] 11 | }, 12 | "nullable": [] 13 | }, 14 | "hash": "61977eb455a29c663ad3e344684e3dee119c43670b2443444bf7533cf51cb4a5" 15 | } 16 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-6834107f343e172f08ced4bc64e7099b7e27bd3e9a5ae96f77761fe12be375ff.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM discord_oauth_tokens WHERE user_id= $1", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "6834107f343e172f08ced4bc64e7099b7e27bd3e9a5ae96f77761fe12be375ff" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-72efcd2b9598423b2ac32fc51232e3da3bf281ae995f49993e09d6a8c519b382.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT count(*) FROM guild_scripts WHERE guild_id = $1;", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "count", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8" 15 | ] 16 | }, 17 | "nullable": [ 18 | null 19 | ] 20 | }, 21 | "hash": "72efcd2b9598423b2ac32fc51232e3da3bf281ae995f49993e09d6a8c519b382" 22 | } 23 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-748ac769d3e4dfc3df429382f457413f3406f1fcb883171d1d0a2d24751631aa.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM bucket_store WHERE guild_id = $1", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "748ac769d3e4dfc3df429382f457413f3406f1fcb883171d1d0a2d24751631aa" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-749c598d03c6f8027e0213b14b630f0629add4e95db7920d11071b569244c1a2.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM scheduled_tasks WHERE guild_id = $1 AND plugin_id = $2 AND name = $3 AND unique_key = $4", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Int8", 10 | "Text", 11 | "Text" 12 | ] 13 | }, 14 | "nullable": [] 15 | }, 16 | "hash": "749c598d03c6f8027e0213b14b630f0629add4e95db7920d11071b569244c1a2" 17 | } 18 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-7a4ad681004a5ab19aaf14ccd54872fa8fc0b1dbca60b0b2e66c35545fe6d91b.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM bucket_store WHERE guild_id = $1 AND plugin_id = $2 AND bucket = $3 AND key ILIKE $4 AND (expires_at IS NULL OR expires_at > now());", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Int8", 10 | "Text", 11 | "Text" 12 | ] 13 | }, 14 | "nullable": [] 15 | }, 16 | "hash": "7a4ad681004a5ab19aaf14ccd54872fa8fc0b1dbca60b0b2e66c35545fe6d91b" 17 | } 18 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-b52036bab2b54cc5a1440770338a0718f875ac7e99680e6e4dcc22da415fb4a6.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "UPDATE plugins SET installed_guilds = (SELECT COUNT(*) FROM guild_scripts WHERE plugin_id = plugins.id);", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [] 8 | }, 9 | "nullable": [] 10 | }, 11 | "hash": "b52036bab2b54cc5a1440770338a0718f875ac7e99680e6e4dcc22da415fb4a6" 12 | } 13 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-cc88c22e1eef7e4f96c76549701867a15a38ec3b31e15d8e4a8adea6861fa215.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "INSERT INTO plugin_images (plugin_id, image_id, created_at, description, position, kind)\n VALUES ($1, $2, now(), $3, $4, $5)\n ON CONFLICT (plugin_id, image_id) DO UPDATE SET\n description = $3;", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Uuid", 10 | "Text", 11 | "Int4", 12 | "Int4" 13 | ] 14 | }, 15 | "nullable": [] 16 | }, 17 | "hash": "cc88c22e1eef7e4f96c76549701867a15a38ec3b31e15d8e4a8adea6861fa215" 18 | } 19 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-d5283a2a6d9b921a4cfac71ce1c5f1b27be3db5e2daa474610eede82bdcbb78f.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM scheduled_tasks WHERE guild_id = $1 AND id = $2", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Int8" 10 | ] 11 | }, 12 | "nullable": [] 13 | }, 14 | "hash": "d5283a2a6d9b921a4cfac71ce1c5f1b27be3db5e2daa474610eede82bdcbb78f" 15 | } 16 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-d62c42a65e39b7e77f32c39a80317e1628663f2436e1581d74744786b21461f1.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM web_sessions WHERE token= $1", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Text" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "d62c42a65e39b7e77f32c39a80317e1628663f2436e1581d74744786b21461f1" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-d7e76694410b149d5f8ced42a401967eed6a861f2a820b7eff8ad7cf188da542.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "SELECT exec_at FROM scheduled_tasks WHERE guild_id = $1 AND plugin_id || '_' || name = ANY($2::text[]) AND (NOT id = ANY ($3::BIGINT[])) ORDER BY exec_at ASC LIMIT 1", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "exec_at", 9 | "type_info": "Timestamptz" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "TextArray", 16 | "Int8Array" 17 | ] 18 | }, 19 | "nullable": [ 20 | false 21 | ] 22 | }, 23 | "hash": "d7e76694410b149d5f8ced42a401967eed6a861f2a820b7eff8ad7cf188da542" 24 | } 25 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-e79c15d9c1c9d4ad7413273d111170121bf1321ec30a2dd6469de54f4ef6c9aa.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM scheduled_tasks WHERE guild_id = $1;", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8" 9 | ] 10 | }, 11 | "nullable": [] 12 | }, 13 | "hash": "e79c15d9c1c9d4ad7413273d111170121bf1321ec30a2dd6469de54f4ef6c9aa" 14 | } 15 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-faf28d6116d9dadf33e57b5dc3b7b56e57b7323fd9fb5e4596865bdfc4b0bc75.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "DELETE FROM guild_scripts WHERE guild_id = $1 AND name = $2;", 4 | "describe": { 5 | "columns": [], 6 | "parameters": { 7 | "Left": [ 8 | "Int8", 9 | "Text" 10 | ] 11 | }, 12 | "nullable": [] 13 | }, 14 | "hash": "faf28d6116d9dadf33e57b5dc3b7b56e57b7323fd9fb5e4596865bdfc4b0bc75" 15 | } 16 | -------------------------------------------------------------------------------- /components/stores/.sqlx/query-ffb221846f835515ad94e2f6b7fa6ffbe0c223004cb1fd6307909b497bef7e3a.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "PostgreSQL", 3 | "query": "UPDATE guild_scripts SET original_source = $2, plugin_version_number = $3 WHERE plugin_id = $1 AND plugin_auto_update RETURNING guild_id", 4 | "describe": { 5 | "columns": [ 6 | { 7 | "ordinal": 0, 8 | "name": "guild_id", 9 | "type_info": "Int8" 10 | } 11 | ], 12 | "parameters": { 13 | "Left": [ 14 | "Int8", 15 | "Text", 16 | "Int4" 17 | ] 18 | }, 19 | "nullable": [ 20 | false 21 | ] 22 | }, 23 | "hash": "ffb221846f835515ad94e2f6b7fa6ffbe0c223004cb1fd6307909b497bef7e3a" 24 | } 25 | -------------------------------------------------------------------------------- /components/stores/migrations/20211109130523_script_contributes_commands.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE guild_scripts 3 | ADD COLUMN IF NOT EXISTS contributes_commands jsonb NOT NULL DEFAULT '[]'; 4 | 5 | -------------------------------------------------------------------------------- /components/stores/migrations/20211126152525_timers.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | CREATE TABLE IF NOT EXISTS interval_timers ( 3 | guild_id bigint NOT NULL, 4 | script_id bigint NOT NULL, 5 | timer_name text NOT NULL, 6 | interval_minutes int, 7 | interval_cron text, 8 | last_run_at timestamp with time zone NOT NULL, 9 | created_at timestamp with time zone NOT NULL, 10 | updated_at timestamp with time zone NOT NULL, 11 | PRIMARY KEY (guild_id, script_id, timer_name) 12 | ); 13 | 14 | ALTER TABLE guild_scripts 15 | ADD COLUMN IF NOT EXISTS contributes_interval_timers jsonb NOT NULL DEFAULT '[]'; 16 | 17 | -------------------------------------------------------------------------------- /components/stores/migrations/20211126181955_guild_whitelist.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | CREATE TABLE IF NOT EXISTS guild_whitelist ( 3 | guild_id bigint PRIMARY KEY NOT NULL, 4 | created_at timestamp with time zone NOT NULL DEFAULT now() 5 | ); 6 | 7 | -------------------------------------------------------------------------------- /components/stores/migrations/20211204191757_bucketstore.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | CREATE TABLE IF NOT EXISTS bucket_store ( 3 | guild_id bigint NOT NULL, 4 | bucket text NOT NULL, 5 | key text NOT NULL, 6 | created_at timestamp with time zone NOT NULL, 7 | updated_at timestamp with time zone NOT NULL, 8 | expires_at timestamp with time zone, 9 | -- only one and atleast one of these has to be present 10 | value_json jsonb, 11 | value_float double precision, 12 | PRIMARY KEY (guild_id, bucket, key) 13 | ); 14 | 15 | CREATE INDEX bucket_store_float_idx ON bucket_store (guild_id, bucket, value_float) 16 | WHERE (value_float IS NOT NULL); 17 | 18 | -------------------------------------------------------------------------------- /components/stores/migrations/20211229112329_scheduled_tasks.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | CREATE TABLE IF NOT EXISTS scheduled_tasks ( 3 | id bigserial PRIMARY KEY, 4 | guild_id bigint NOT NULL, 5 | name text NOT NULL, 6 | unique_key text, 7 | value jsonb NOT NULL, 8 | exec_at timestamp with time zone NOT NULL 9 | ); 10 | 11 | CREATE INDEX scheduled_tasks_guild_id_exec_at_idx ON scheduled_tasks (guild_id, exec_at); 12 | 13 | CREATE UNIQUE INDEX scheduled_tasks_unique_key_idx ON scheduled_tasks (guild_id, name, unique_key) 14 | WHERE (unique_key IS NOT NULL); 15 | 16 | -------------------------------------------------------------------------------- /components/stores/migrations/20220211194033_guild_left_at.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE joined_guilds 3 | ADD COLUMN IF NOT EXISTS left_at TIMESTAMP WITH TIME ZONE; 4 | 5 | -------------------------------------------------------------------------------- /components/stores/migrations/20220314150414_premium.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | CREATE TABLE IF NOT EXISTS premium_slots ( 3 | id bigserial PRIMARY KEY, 4 | title text NOT NULL, 5 | user_id bigint, 6 | message text NOT NULL, 7 | source text NOT NULL, 8 | source_id text NOT NULL, 9 | tier int NOT NULL, 10 | state int NOT NULL, 11 | created_at timestamp with time zone NOT NULL, 12 | updated_at timestamp with time zone NOT NULL, 13 | expires_at timestamp with time zone NOT NULL, 14 | manage_url text NOT NULL, 15 | attached_guild_id bigint 16 | ); 17 | 18 | CREATE INDEX IF NOT EXISTS premium_slots_guild_id_idx ON premium_slots (attached_guild_id); 19 | 20 | CREATE INDEX IF NOT EXISTS premium_slots_user_id_idx ON premium_slots (user_id); 21 | 22 | CREATE UNIQUE INDEX IF NOT EXISTS premium_slots_source_id_idx ON premium_slots (source, source_id); 23 | 24 | -------------------------------------------------------------------------------- /components/stores/migrations/20230210150648_guild_scripts_unique_plugin_name.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE guild_scripts 3 | DROP CONSTRAINT guild_scripts_guild_id_name_key; 4 | 5 | CREATE UNIQUE INDEX guild_scripts_guild_id_name_key ON guild_scripts (guild_id, plugin_id, name); 6 | 7 | -------------------------------------------------------------------------------- /components/stores/migrations/20230227165241_guild_scripts_plugin_version_number.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE guild_scripts 3 | ADD COLUMN plugin_version_number int; 4 | 5 | -------------------------------------------------------------------------------- /components/stores/migrations/20240217073053_plugin_images.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE IF NOT EXISTS images( 2 | id uuid PRIMARY KEY DEFAULT gen_random_uuid(), 3 | uploaded_by bigint NOT NULL, 4 | plugin_id bigint REFERENCES plugins(id) ON DELETE CASCADE, 5 | width int NOT NULL, 6 | height int NOT NULL, 7 | bytes bytea, 8 | created_at timestamptz NOT NULL, 9 | deleted_at timestamptz 10 | ); 11 | 12 | CREATE TABLE IF NOT EXISTS plugin_images( 13 | plugin_id bigint NOT NULL REFERENCES plugins(id) ON DELETE CASCADE, 14 | image_id uuid NOT NULL REFERENCES images(id) ON DELETE CASCADE, 15 | created_at timestamptz NOT NULL, 16 | description text NOT NULL, 17 | position int NOT NULL, 18 | kind int NOT NULL, 19 | PRIMARY KEY (plugin_id, image_id) 20 | ); 21 | 22 | -------------------------------------------------------------------------------- /components/stores/migrations/20240222112603_script_settings.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE guild_scripts 3 | ADD COLUMN settings_values jsonb; 4 | 5 | ALTER TABLE guild_scripts 6 | ADD COLUMN settings_definitions jsonb; 7 | 8 | -------------------------------------------------------------------------------- /components/stores/migrations/20240311161022_stripe_customer_id.sql: -------------------------------------------------------------------------------- 1 | -- Add migration script here 2 | ALTER TABLE user_meta 3 | ADD COLUMN stripe_customer_id TEXT; 4 | 5 | -------------------------------------------------------------------------------- /components/stores/migrations/20240618181258_plugin_stats.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE plugins 2 | ADD COLUMN installed_guilds integer; 3 | 4 | ALTER TABLE plugins 5 | ADD COLUMN installed_guilds_updated_at timestamp with time zone; 6 | 7 | ALTER TABLE plugins 8 | ADD COLUMN discord_thread_id bigint; 9 | 10 | -------------------------------------------------------------------------------- /components/stores/src/inmemory/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod web; 2 | -------------------------------------------------------------------------------- /components/stores/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod bucketstore; 2 | pub mod config; 3 | pub mod inmemory; 4 | pub mod timers; 5 | pub mod web; 6 | 7 | use sqlx::{postgres::PgPoolOptions, PgPool}; 8 | 9 | #[derive(Clone)] 10 | pub struct Db { 11 | pool: PgPool, 12 | } 13 | 14 | impl Db { 15 | pub fn new_with_pool(pool: PgPool) -> Self { 16 | Self { pool } 17 | } 18 | 19 | pub async fn new_with_url(url: &str) -> Result { 20 | let pool = PgPoolOptions::new().max_connections(5).connect(url).await?; 21 | 22 | Ok(Self { pool }) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /components/stripe-premium/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "stripe-premium" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../stores" } 10 | common = { path = "../common" } 11 | 12 | tracing = { workspace = true } 13 | anyhow = { workspace = true } 14 | axum = { workspace = true } 15 | chrono = { workspace = true } 16 | twilight-model = { workspace = true } 17 | 18 | async-stripe = { version = "0.34.1", default-features = false, features = [ 19 | "webhook-events", 20 | "checkout", 21 | "runtime-tokio-hyper", 22 | "connect", 23 | ] } 24 | -------------------------------------------------------------------------------- /components/tscompiler/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tscompiler" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | swc_common = { version = "0.40.0", features = ["sourcemap"] } 10 | sourcemap = "9.0" 11 | swc = "0.289.0" 12 | swc_ecmascript = { version = "0.256.0", features = ["parser"] } 13 | -------------------------------------------------------------------------------- /components/tscompiler/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod compiler; 2 | 3 | pub use compiler::*; 4 | -------------------------------------------------------------------------------- /components/validation/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "validation" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | stores = { path = "../../components/stores" } 10 | runtime-models = { path = "../../components/runtime-models" } 11 | 12 | regex = { workspace = true } 13 | lazy_static = { workspace = true } 14 | twilight-model = { workspace = true } 15 | serde = { workspace = true } 16 | serde_json = { workspace = true } 17 | -------------------------------------------------------------------------------- /components/vm/src/botloader-core-rt.js: -------------------------------------------------------------------------------- 1 | // Deno.core.initializeAsyncOps(); -------------------------------------------------------------------------------- /components/vm/src/botloader-core.js: -------------------------------------------------------------------------------- 1 | (function($window){ 2 | 3 | 4 | $window.BotloaderCore = { 5 | dispatchEvent: () => {}, 6 | dispatchWrapper: async (evt) => { 7 | $window.BotloaderCore.dispatchEvent(evt); 8 | }, 9 | } 10 | })(this); -------------------------------------------------------------------------------- /components/webapi/Dockerfile: -------------------------------------------------------------------------------- 1 | # You need to build the base image first and tag it as botloader-base 2 | FROM botloader-base as builder 3 | RUN cargo build --release --bin webapi 4 | 5 | #run 6 | FROM debian:bookworm AS runtime 7 | WORKDIR /app 8 | COPY --from=builder /app/target/release/webapi /usr/local/bin/botloader-webapi 9 | 10 | RUN apt-get update 11 | RUN apt-get install ca-certificates -y 12 | 13 | EXPOSE 7447 14 | EXPOSE 7801 15 | 16 | ENTRYPOINT ["/usr/local/bin/botloader-webapi"] -------------------------------------------------------------------------------- /components/webapi/src/middlewares/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod bl_admin_only; 2 | pub mod cors; 3 | pub mod guild; 4 | pub mod mw_session; 5 | pub mod plugins; 6 | 7 | pub use cors::*; 8 | pub use guild::*; 9 | pub use mw_session::*; 10 | -------------------------------------------------------------------------------- /components/webapi/src/routes/errortest.rs: -------------------------------------------------------------------------------- 1 | use crate::{errors::ApiErrorResponse, ApiResult}; 2 | 3 | use tracing::instrument; 4 | 5 | #[instrument] 6 | pub async fn handle_errortest() -> ApiResult<()> { 7 | Err(ApiErrorResponse::InternalError) 8 | } 9 | -------------------------------------------------------------------------------- /components/webapi/src/routes/general.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | extract::{Extension, State}, 3 | response::IntoResponse, 4 | Json, 5 | }; 6 | 7 | use crate::{ 8 | app_state::AppState, errors::ApiErrorResponse, middlewares::LoggedInSession, ApiResult, 9 | }; 10 | 11 | use tracing::error; 12 | 13 | pub async fn get_current_user( 14 | Extension(session): Extension, 15 | ) -> ApiResult { 16 | let user = session.api_client.current_user().await.map_err(|err| { 17 | error!(%err, "failed fetching user"); 18 | ApiErrorResponse::InternalError 19 | })?; 20 | 21 | Ok(Json(user)) 22 | } 23 | 24 | pub async fn get_news(State(state): State) -> impl IntoResponse { 25 | let latest = state.news_handle.get_items(); 26 | Json(latest) 27 | } 28 | -------------------------------------------------------------------------------- /components/webapi/src/routes/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod admin; 2 | pub mod auth; 3 | pub mod errortest; 4 | pub mod general; 5 | pub mod guilds; 6 | pub mod plugins; 7 | pub mod premium; 8 | pub mod scripts; 9 | pub mod sessions; 10 | pub mod stripe; 11 | pub mod vm; 12 | pub mod ws; 13 | -------------------------------------------------------------------------------- /components/webapi/src/routes/vm.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | extract::{Extension, State}, 3 | response::IntoResponse, 4 | }; 5 | use tracing::error; 6 | use twilight_model::user::CurrentUserGuild; 7 | 8 | use crate::{app_state::AppState, errors::ApiErrorResponse, util::EmptyResponse, ApiResult}; 9 | 10 | pub async fn reload_guild_vm( 11 | Extension(current_guild): Extension, 12 | State(state): State, 13 | ) -> ApiResult { 14 | state 15 | .bot_rpc_client 16 | .restart_guild_vm(current_guild.id) 17 | .await 18 | .map_err(|err| { 19 | error!(%err, "failed reloading guild vm"); 20 | ApiErrorResponse::InternalError 21 | })?; 22 | 23 | Ok(EmptyResponse) 24 | } 25 | -------------------------------------------------------------------------------- /components/webapi/src/util.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | body::Body, 3 | http::StatusCode, 4 | response::{IntoResponse, Response}, 5 | }; 6 | 7 | pub struct EmptyResponse; 8 | 9 | impl IntoResponse for EmptyResponse { 10 | fn into_response(self) -> Response { 11 | Response::builder() 12 | .status(StatusCode::NO_CONTENT) 13 | .body(Body::empty()) 14 | .unwrap() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /frontend-common/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ -------------------------------------------------------------------------------- /frontend-common/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "botloader-common", 3 | "version": "1.0.0", 4 | "description": "common stuff for interacting with the botloader api!", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "devDependencies": { 8 | "typescript": "^5.3.3" 9 | }, 10 | "scripts": { 11 | "build": "npx tsc" 12 | }, 13 | "files": [ 14 | "/dist" 15 | ] 16 | } -------------------------------------------------------------------------------- /frontend-common/src/index.ts: -------------------------------------------------------------------------------- 1 | export const BOTLOADER_TEST_VAR = 10; 2 | export * from './api_client'; 3 | export * from './api_models'; -------------------------------------------------------------------------------- /frontend-common/src/lib.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace console { 2 | export function log(...args: any): any; 3 | } -------------------------------------------------------------------------------- /frontend-common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2015", 5 | "declaration": true, 6 | "outDir": "./dist", 7 | "strict": true, 8 | "lib": [ 9 | "ES2015" 10 | ], 11 | }, 12 | "include": [ 13 | "src/**/*" 14 | ] 15 | } -------------------------------------------------------------------------------- /frontend/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .env -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | public/docs 8 | public/typings.tar 9 | 10 | # testing 11 | /coverage 12 | 13 | # production 14 | /build 15 | 16 | # misc 17 | .DS_Store 18 | .env.local 19 | .env.development.local 20 | .env.test.local 21 | .env.production.local 22 | 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | # Botloader frontend 2 | 3 | This is the frontend for botloader, it's set up using create-react-app. 4 | 5 | # Running it 6 | 7 | First build frontend-common, that package holds common data structures and a API client. 8 | 9 | `cd frontend-common && npm install && npm run build` 10 | 11 | Then install the deps of the frontend: 12 | 13 | `npm install` 14 | 15 | Then you can run it using `npm start`. 16 | 17 | # Running it using api.botloader.io 18 | 19 | You can run the frontend without the rest of the stack by using api.botloader.io as the API server. 20 | 21 | To do this first follow the steps in the "Running it" except the last one, instead use the `run_using_api.sh` script. -------------------------------------------------------------------------------- /frontend/config/jest/babelTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const babelJest = require('babel-jest').default; 4 | 5 | const hasJsxRuntime = (() => { 6 | if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') { 7 | return false; 8 | } 9 | 10 | try { 11 | require.resolve('react/jsx-runtime'); 12 | return true; 13 | } catch (e) { 14 | return false; 15 | } 16 | })(); 17 | 18 | module.exports = babelJest.createTransformer({ 19 | presets: [ 20 | [ 21 | require.resolve('babel-preset-react-app'), 22 | { 23 | runtime: hasJsxRuntime ? 'automatic' : 'classic', 24 | }, 25 | ], 26 | ], 27 | babelrc: false, 28 | configFile: false, 29 | }); 30 | -------------------------------------------------------------------------------- /frontend/config/jest/cssTransform.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // This is a custom Jest transformer turning style imports into empty objects. 4 | // http://facebook.github.io/jest/docs/en/webpack.html 5 | 6 | module.exports = { 7 | process() { 8 | return 'module.exports = {};'; 9 | }, 10 | getCacheKey() { 11 | // The output is always the same. 12 | return 'cssTransform'; 13 | }, 14 | }; 15 | -------------------------------------------------------------------------------- /frontend/config/webpack/persistentCache/createEnvironmentHash.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | const { createHash } = require('crypto'); 3 | 4 | module.exports = env => { 5 | const hash = createHash('md5'); 6 | hash.update(JSON.stringify(env)); 7 | 8 | return hash.digest('hex'); 9 | }; 10 | -------------------------------------------------------------------------------- /frontend/nginx.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | root /usr/share/nginx/html; 5 | index index.html; 6 | 7 | rewrite ^/book$ /book/ permanent; 8 | rewrite ^/docs$ /docs/ permanent; 9 | 10 | location / { 11 | try_files $uri /index.html; 12 | } 13 | 14 | location /docs/ { 15 | try_files $uri $uri.html /docs/index.html; 16 | } 17 | 18 | location /book/ { 19 | try_files $uri $uri.html /book/introduction.html; 20 | } 21 | } -------------------------------------------------------------------------------- /frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/public/favicon.ico -------------------------------------------------------------------------------- /frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/public/logo192.png -------------------------------------------------------------------------------- /frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/public/logo512.png -------------------------------------------------------------------------------- /frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "Botloader", 3 | "name": "Botloader", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "48x48", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } -------------------------------------------------------------------------------- /frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /frontend/run_using_api.sh: -------------------------------------------------------------------------------- 1 | #/bin/sh 2 | 3 | # Keep in mind you still have to build ../frontend-common on changes to it 4 | 5 | cd "${0%/*}" 6 | 7 | export REACT_APP_BOTLOADER_API_BASE="http://api.botloader.io" 8 | export REACT_APP_BOTLOADER_CLIENT_ID="852626272794181692" 9 | 10 | npm start -------------------------------------------------------------------------------- /frontend/src/BuildConfig.tsx: -------------------------------------------------------------------------------- 1 | export const BuildConfig = { 2 | botloaderApiBase: process.env["REACT_APP_BOTLOADER_API_BASE"] || "http://localhost:7447", 3 | botloaderWsUrl: process.env["REACT_APP_BOTLOADER_WS_URL"] || "ws://localhost:7447", 4 | botloaderClientId: process.env["REACT_APP_BOTLOADER_CLIENT_ID"] || "", 5 | } 6 | 7 | console.log(`using api base: ${BuildConfig.botloaderApiBase}`); -------------------------------------------------------------------------------- /frontend/src/Util.tsx: -------------------------------------------------------------------------------- 1 | import { ApiFetcher } from "botloader-common"; 2 | 3 | export function CreateFetcher(): ApiFetcher { 4 | return { 5 | fetch: async (path, opts) => await window.fetch(path, opts) 6 | } 7 | } -------------------------------------------------------------------------------- /frontend/src/components/AsyncOpButton.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from "@mui/material"; 2 | import { useState } from "react" 3 | 4 | type Props = { 5 | label: string, 6 | onClick: () => any, 7 | className?: string, 8 | disabled?: boolean, 9 | } 10 | 11 | export function AsyncOpButton(props: Props) { 12 | const [status, setStatus] = useState(false); 13 | 14 | 15 | async function doOp() { 16 | setStatus(true); 17 | await props.onClick(); 18 | setStatus(false); 19 | } 20 | 21 | return 27 | } -------------------------------------------------------------------------------- /frontend/src/components/BLLink.tsx: -------------------------------------------------------------------------------- 1 | import { Button, ButtonProps } from "@mui/material"; 2 | import { Link } from "react-router-dom"; 3 | 4 | export function BlLink(props: { 5 | to: string, 6 | skipClientRouting?: boolean 7 | newTab?: boolean 8 | fullWidth?: boolean 9 | buttonSx?: ButtonProps["sx"] 10 | } & Pick) { 11 | return 20 | } -------------------------------------------------------------------------------- /frontend/src/components/CodeBlock.tsx: -------------------------------------------------------------------------------- 1 | import { Box } from "@mui/material"; 2 | 3 | export function CodeBlock({ children }: { children: React.ReactElement }) { 4 | return 12 | {/* */} 13 | {children} 14 | {/* */} 15 | 16 | } -------------------------------------------------------------------------------- /frontend/src/components/Gist.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export function Gist({id, file}:{id: string, file?: string}){ 4 | const fileArg = file ? `?file=${file}` : ""; 5 | 6 | return 9 | } -------------------------------------------------------------------------------- /frontend/src/components/GlobalState.tsx: -------------------------------------------------------------------------------- 1 | import { BotGuild } from "botloader-common" 2 | import { Session } from "../modules/session/SessionContext" 3 | 4 | export type GlobalState = { 5 | session: Session, 6 | guilds: BotGuild[], 7 | } -------------------------------------------------------------------------------- /frontend/src/components/GuildIcon.tsx: -------------------------------------------------------------------------------- 1 | import { guildIconUrl } from "./Util" 2 | 3 | type Props = { 4 | guild: { icon?: string, name: string, id: string } 5 | discordSize?: 32 | 64 | 128, 6 | size?: number, 7 | } 8 | 9 | export function GuildIcon({ guild, size, discordSize }: Props) { 10 | let resolvedDiscordSize = discordSize ?? 64; 11 | let resolvedSize = size ?? 64; 12 | if (guild.icon) { 13 | return {guild.name 14 | } else { 15 | return
16 | {guild.name.split(" ").map((v) => v.charAt(0))} 17 |
18 | } 19 | } -------------------------------------------------------------------------------- /frontend/src/components/LinkRouter.tsx: -------------------------------------------------------------------------------- 1 | import { Link, LinkProps } from "@mui/material"; 2 | import { 3 | Link as RouterLink, 4 | } from 'react-router-dom'; 5 | 6 | interface LinkRouterProps extends LinkProps { 7 | to: string; 8 | replace?: boolean; 9 | } 10 | 11 | export function LinkRouter(props: LinkRouterProps) { 12 | return ; 13 | } -------------------------------------------------------------------------------- /frontend/src/components/Loading.tsx: -------------------------------------------------------------------------------- 1 | import { LinearProgress } from "@mui/material"; 2 | 3 | export function Loading() { 4 | return 5 | } -------------------------------------------------------------------------------- /frontend/src/components/NewsItem.tsx: -------------------------------------------------------------------------------- 1 | import { NewsItem } from "botloader-common"; 2 | import ReactMarkdown from "react-markdown"; 3 | import { Card, CardContent, CardHeader, Typography } from "@mui/material"; 4 | 5 | export function NewsItemComponent(props: { item: NewsItem }) { 6 | return 7 | 11 | 12 | 13 | {props.item.content} 14 | 15 | 16 | 17 | } -------------------------------------------------------------------------------- /frontend/src/components/Panel.css: -------------------------------------------------------------------------------- 1 | .panel { 2 | background-color: rgba(0, 0, 0, 0.2); 3 | padding: 10px; 4 | border-radius: 5px; 5 | margin: 5px; 6 | display: flex; 7 | flex-direction: column; 8 | } 9 | 10 | .panel-body { 11 | display: flex; 12 | flex-direction: column; 13 | align-items: stretch; 14 | flex-grow: 1; 15 | } 16 | 17 | .panel h1, 18 | .panel h2, 19 | .panel h3 { 20 | border-bottom: 2px solid var(--main-bg-color); 21 | } 22 | -------------------------------------------------------------------------------- /frontend/src/components/Panel.tsx: -------------------------------------------------------------------------------- 1 | import React from "react" 2 | import "./Panel.css" 3 | 4 | type Props = { 5 | children?: React.ReactNode, 6 | title?: string, 7 | className?: string, 8 | } 9 | 10 | export function Panel(props: Props) { 11 | return
12 | {props.title ?

{props.title}

: null} 13 |
14 | {props.children} 15 |
16 |
17 | } -------------------------------------------------------------------------------- /frontend/src/components/PluginIcon.tsx: -------------------------------------------------------------------------------- 1 | import { Avatar } from "@mui/material"; 2 | import { Plugin } from "botloader-common"; 3 | import { pluginImageUrl } from "../misc/pluginImageUrl"; 4 | 5 | const sizes = { 6 | xs: 32, 7 | sm: 48, 8 | m: 64, 9 | } 10 | 11 | export function PluginIcon({ plugin, size }: { plugin: Plugin, size?: keyof typeof sizes }) { 12 | const iconImage = plugin.images.find(v => v.kind === "Icon") 13 | 14 | return 22 | {plugin.name[0] ?? "?"} 23 | 24 | } -------------------------------------------------------------------------------- /frontend/src/components/PluginProvider.tsx: -------------------------------------------------------------------------------- 1 | import { Plugin } from "botloader-common"; 2 | import { createFetchDataContext, FetchData } from "./FetchData"; 3 | import { useSession } from "../modules/session/useSession"; 4 | import { useCallback } from "react"; 5 | 6 | export const pluginContext = createFetchDataContext(); 7 | 8 | 9 | export function MaybePluginProvider({ pluginId, children }: { pluginId?: number, children: React.ReactNode }) { 10 | const session = useSession(); 11 | 12 | const fetchPlugin = useCallback(async () => { 13 | if (!pluginId) { 14 | throw new Error("No plugin id") 15 | } 16 | 17 | let scripts = await session.apiClient.getPlugin(pluginId!); 18 | return scripts; 19 | }, [pluginId, session]) 20 | 21 | return 22 | {children} 23 | 24 | } -------------------------------------------------------------------------------- /frontend/src/components/ScriptEnableToggle.tsx: -------------------------------------------------------------------------------- 1 | import { Switch } from "@mui/material"; 2 | import { Script } from "botloader-common"; 3 | import { useState } from "react"; 4 | import { useCurrentGuildScripts } from "../modules/guilds/GuildScriptsProvider"; 5 | 6 | export function ScriptEnableToggle({ script }: { script: Script }) { 7 | const [isToggling, setIsToggling] = useState(false) 8 | const { toggleScript } = useCurrentGuildScripts(); 9 | 10 | return { 15 | setIsToggling(true) 16 | toggleScript(script.id, evt.target.checked) 17 | .finally(() => setIsToggling(false)) 18 | }} /> 19 | } -------------------------------------------------------------------------------- /frontend/src/components/Util.tsx: -------------------------------------------------------------------------------- 1 | import { User } from "botloader-common"; 2 | 3 | export function guildIconUrl(g: { icon?: string, id: string }, size: 32 | 64 | 128 = 64): string { 4 | 5 | const extension = 6 | g.icon?.startsWith("a_") ? "gif" : "png"; 7 | 8 | return `https://cdn.discordapp.com/icons/${g.id}/${g.icon}.${extension}?size=${size}` 9 | } 10 | 11 | export function userAvatarUrl(u: Pick, size = 64): string { 12 | if (u.avatar) { 13 | const extension = 14 | u.avatar.startsWith("a_") ? "gif" : "png"; 15 | 16 | return `https://cdn.discordapp.com/avatars/${u.id}/${u.avatar}.${extension}?size=${size}` 17 | } else { 18 | const discriminator = parseInt(u.discriminator); 19 | 20 | return `https://cdn.discordapp.com/embed/avatars/${discriminator % 5}.png?size=${size}` 21 | } 22 | } -------------------------------------------------------------------------------- /frontend/src/components/useMonacoFixed.tsx: -------------------------------------------------------------------------------- 1 | // useMonaco in monaco-editor/react is broken in strict mode, so i removed the troublesome portion in my copy here 2 | 3 | import { useEffect, useState } from 'react'; 4 | import loader from '@monaco-editor/loader'; 5 | 6 | function useMonacoFixed() { 7 | const [monaco, setMonaco] = useState(loader.__getMonacoInstance()); 8 | 9 | useEffect(() => { 10 | let cancelable: ReturnType; 11 | 12 | if (!monaco) { 13 | cancelable = loader.init(); 14 | 15 | cancelable.then((monaco) => { 16 | setMonaco(monaco); 17 | }); 18 | } 19 | // eslint-disable-next-line react-hooks/exhaustive-deps 20 | }, []); 21 | 22 | return monaco; 23 | } 24 | 25 | export default useMonacoFixed; 26 | -------------------------------------------------------------------------------- /frontend/src/img/loaderscreenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/src/img/loaderscreenshot.png -------------------------------------------------------------------------------- /frontend/src/img/pogshowcase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/src/img/pogshowcase.png -------------------------------------------------------------------------------- /frontend/src/img/showcase_editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/src/img/showcase_editor.png -------------------------------------------------------------------------------- /frontend/src/img/showcase_plugin_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/src/img/showcase_plugin_settings.png -------------------------------------------------------------------------------- /frontend/src/img/showcase_plugins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Botloader/botloader/a67c49e45d0d87bc5e2fe04de25065a7a5c8b431/frontend/src/img/showcase_plugins.png -------------------------------------------------------------------------------- /frontend/src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | min-height: 100vh; 3 | } 4 | 5 | #root { 6 | min-height: 100vh; 7 | display: flex; 8 | flex-direction: column; 9 | } -------------------------------------------------------------------------------- /frontend/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import './index.css'; 3 | import App from './App'; 4 | import { createRoot } from 'react-dom/client'; 5 | 6 | const domNode = document.getElementById('root'); 7 | const root = createRoot(domNode!); 8 | root.render( 9 | 10 | 11 | ); -------------------------------------------------------------------------------- /frontend/src/misc/js-untar.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'js-untar' { 2 | export interface File { 3 | name: string, 4 | mode: string, 5 | type: string, 6 | 7 | readAsString(): string, 8 | readAsJSON(): unknown, 9 | } 10 | 11 | export default function untar(buf: ArrayBuffer): Promise; 12 | } -------------------------------------------------------------------------------- /frontend/src/misc/pluginImageUrl.ts: -------------------------------------------------------------------------------- 1 | import { BuildConfig } from "../BuildConfig"; 2 | 3 | export function pluginImageUrl(pluginId: number, imageId: string) { 4 | return `${BuildConfig.botloaderApiBase}/media/plugins/${pluginId}/images/${imageId}.webp` 5 | } -------------------------------------------------------------------------------- /frontend/src/misc/useTraceChangedProps.tsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useRef } from "react"; 2 | 3 | export function useTraceChangedProps(props: any) { 4 | const prev = useRef(props); 5 | console.log(prev, props) 6 | useEffect(() => { 7 | const changedProps = Object.entries(props).reduce((ps, [k, v]) => { 8 | if (prev.current[k] !== v) { 9 | (ps as any)[k] = [prev.current[k], v]; 10 | } 11 | return ps; 12 | }, {}); 13 | if (Object.keys(changedProps).length > 0) { 14 | console.log('CHANGED PROPS:', changedProps); 15 | } 16 | prev.current = props; 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /frontend/src/modules/session/RequireLoggedInSession.tsx: -------------------------------------------------------------------------------- 1 | import { Navigate } from "react-router-dom"; 2 | import { useSession } from "./useSession"; 3 | import { Loading } from "../../components/Loading"; 4 | 5 | export function RequireLoggedInSession({ children }: { children: React.ReactNode }) { 6 | const session = useSession(); 7 | 8 | if (!session.initialized) { 9 | return 10 | } 11 | 12 | if (session.user) { 13 | return <>{children} 14 | } else if (session.signingIn) { 15 | return

Logging you in...

16 | } else { 17 | return 18 | } 19 | } -------------------------------------------------------------------------------- /frontend/src/modules/session/useSession.ts: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { Session, SessionContext } from "./SessionContext"; 3 | 4 | export function useSession(): Session { 5 | return useContext(SessionContext); 6 | } 7 | -------------------------------------------------------------------------------- /frontend/src/modules/websocket/useBotloaderWebsocket.tsx: -------------------------------------------------------------------------------- 1 | import { useContext } from "react"; 2 | import { WebsocketContext } from "./WebsocketContext"; 3 | 4 | export function useBotloaderWebsocket() { 5 | const ws = useContext(WebsocketContext) 6 | return ws 7 | } -------------------------------------------------------------------------------- /frontend/src/pages/SamplesPage.css: -------------------------------------------------------------------------------- 1 | .sample-panel iframe { 2 | max-height: 500px !important; 3 | } 4 | -------------------------------------------------------------------------------- /frontend/src/pages/confirm_stripe_purchase/index.tsx: -------------------------------------------------------------------------------- 1 | import { Box, Typography } from "@mui/material"; 2 | import { RouteObject } from "react-router-dom"; 3 | import { BlLink } from "../../components/BLLink"; 4 | 5 | export const routes: RouteObject[] = [ 6 | { 7 | index: true, 8 | element: 9 | } 10 | ] 11 | 12 | 13 | export function ConfirmPurchasePage() { 14 | return 19 | Thanks for supporting the project! 20 | If your new premium/lite slot does not show up contact support in the discord 21 | Back to premium slots 22 | 23 | } -------------------------------------------------------------------------------- /frontend/src/pages/plugins/[pluginId]/source/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { ViewPluginSource } from "../ViewPlugin"; 3 | 4 | export const routes: RouteObject[] = [ 5 | { 6 | index: true, 7 | element: , 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /frontend/src/pages/plugins/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { routes as pluginIdRoutes } from "./[pluginId]"; 3 | import { ViewPlugins } from "./Plugins"; 4 | 5 | export const routes: RouteObject[] = [ 6 | { 7 | children: [ 8 | { 9 | index: true, 10 | element: <> 11 | 12 | 13 | }, 14 | { 15 | path: ":pluginId", 16 | children: pluginIdRoutes, 17 | } 18 | ] 19 | } 20 | ] -------------------------------------------------------------------------------- /frontend/src/pages/servers/SelectServer.css: -------------------------------------------------------------------------------- 1 | /* .guild-select-list { 2 | display: flex; 3 | flex-direction: row; 4 | flex-wrap: wrap; 5 | } 6 | 7 | .guild-select-list img { 8 | width: 64px; 9 | height: 64px; 10 | text-align: center; 11 | color: white; 12 | font-size: 45px; 13 | margin-right: 5px; 14 | } 15 | 16 | .guild-select-list a { 17 | text-decoration: none; 18 | border: none; 19 | } 20 | 21 | .guild-list-item { 22 | background-color: rgba(0, 0, 0, 0.25); 23 | border-radius: 10px; 24 | margin: 10px; 25 | 26 | display: flex; 27 | flex-direction: row; 28 | align-items: center; 29 | 30 | padding: 10px; 31 | 32 | color: white; 33 | } 34 | 35 | .guild-list-item:hover { 36 | background-color: rgba(0, 0, 0, 0.4); 37 | } */ -------------------------------------------------------------------------------- /frontend/src/pages/servers/[guilldId]/scripts/[script_id]/edit/index.tsx: -------------------------------------------------------------------------------- 1 | import { EditGuildScript } from "../../../GuildPage"; 2 | import { OurRouteObject } from "../../../../../../misc/ourRoute"; 3 | 4 | export const routes: OurRouteObject[] = [{ 5 | index: true, 6 | handle: { 7 | breadCrumb: (params, data) => { 8 | return "Edit" 9 | }, 10 | }, 11 | element: 12 | }] -------------------------------------------------------------------------------- /frontend/src/pages/user/general/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { UserGeneralPage } from "./General"; 3 | 4 | export const routes: RouteObject[] = [ 5 | { 6 | index: true, 7 | handle: { 8 | breadCrumb: () => "General" 9 | }, 10 | element: 11 | } 12 | ] -------------------------------------------------------------------------------- /frontend/src/pages/user/plugins/[pluginId]/edit_script/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { EditPluginScriptPage } from "../EditPluginScript"; 3 | 4 | export const routes: RouteObject[] = [ 5 | { 6 | index: true, 7 | handle: { 8 | breadCrumb: () => "Edit" 9 | }, 10 | element: 11 | }, 12 | ] -------------------------------------------------------------------------------- /frontend/src/pages/user/plugins/[pluginId]/edit_script_diff/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { EditPluginScriptPage } from "../EditPluginScript"; 3 | 4 | export const routes: RouteObject[] = [ 5 | { 6 | index: true, 7 | handle: { 8 | breadCrumb: () => "Edit" 9 | }, 10 | element: 11 | }, 12 | ] -------------------------------------------------------------------------------- /frontend/src/pages/user/plugins/index.tsx: -------------------------------------------------------------------------------- 1 | import { UserScriptsPage } from "./Scripts"; 2 | import { routes as pluginIdRoutes } from "./[pluginId]"; 3 | import { OurRouteObject } from "../../../misc/ourRoute"; 4 | 5 | export const routes: OurRouteObject[] = [ 6 | { 7 | handle: { 8 | breadCrumb: () => "Plugins" 9 | }, 10 | children: [ 11 | { 12 | index: true, 13 | element: 14 | }, 15 | { 16 | path: ":pluginId", 17 | children: pluginIdRoutes, 18 | } 19 | ] 20 | } 21 | ] -------------------------------------------------------------------------------- /frontend/src/pages/user/premium/index.tsx: -------------------------------------------------------------------------------- 1 | import { RouteObject } from "react-router-dom"; 2 | import { UserPremiumPage } from "./Premium"; 3 | 4 | export const routes: RouteObject[] = [ 5 | { 6 | index: true, 7 | handle: { 8 | breadCrumb: () => "Premium" 9 | }, 10 | element: 11 | } 12 | ] -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx", 22 | }, 23 | "include": [ 24 | "src" 25 | ], 26 | } -------------------------------------------------------------------------------- /full-gen-types.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # cd to the script location 5 | cd "${0%/*}" 6 | 7 | ./components/runtime-models/gen-move-types.bash 8 | ./components/runtime/src/ts/build-types-copy-frontend.sh -------------------------------------------------------------------------------- /integration-tests/bad_requests.ts: -------------------------------------------------------------------------------- 1 | import { Discord, Tasks } from "botloader"; 2 | import { runOnce, sendScriptCompletion } from "lib"; 3 | 4 | runOnce(script.name, async () => { 5 | for (let i = 0; i < 15; i++) { 6 | try { 7 | await Discord.createMessage("959117510161076266", { content: "invalid test" }); 8 | } catch (e) { } 9 | 10 | } 11 | 12 | await Tasks.schedule("bad_requests_send_more", new Date(Date.now() + (61 * 1000))) 13 | }) 14 | 15 | script.onTask("bad_requests_send_more", async (t) => { 16 | for (let i = 0; i < 15; i++) { 17 | try { 18 | 19 | await Discord.createMessage("959117510161076266", { content: "invalid test" }); 20 | } catch (e) { } 21 | } 22 | 23 | sendScriptCompletion(script.name); 24 | }) -------------------------------------------------------------------------------- /integration-tests/basic.ts: -------------------------------------------------------------------------------- 1 | import { runOnce, sendScriptCompletion } from "lib"; 2 | 3 | runOnce(script.name, () => { 4 | console.log("fun times"); 5 | sendScriptCompletion(script.name); 6 | }) -------------------------------------------------------------------------------- /integration-tests/failing.ts.ignore: -------------------------------------------------------------------------------- 1 | throw new Error("gaming"); -------------------------------------------------------------------------------- /integration-tests/get_members.ts: -------------------------------------------------------------------------------- 1 | import { Discord, HttpClient } from 'botloader'; 2 | import { runOnce, sendScriptCompletion } from 'lib'; 3 | 4 | runOnce(script.name, async () => { 5 | let result = await Discord.getMembers(["852626272794181692", "105487308693757952", "204255221017214977"]) 6 | for (const item of result) { 7 | if (!item) { 8 | throw new Error(`One or more members failed to fetch`); 9 | } 10 | } 11 | 12 | sendScriptCompletion(script.name); 13 | }) -------------------------------------------------------------------------------- /integration-tests/http.ts: -------------------------------------------------------------------------------- 1 | import { HttpClient } from 'botloader'; 2 | import { runOnce, sendScriptCompletion } from 'lib'; 3 | 4 | runOnce(script.name, async () => { 5 | let resp = await HttpClient.get("http://example.com/"); 6 | 7 | sendScriptCompletion(script.name); 8 | }) -------------------------------------------------------------------------------- /integration-tests/interval.ts: -------------------------------------------------------------------------------- 1 | import { Storage } from "botloader"; 2 | import { sendScriptCompletion } from "lib" 3 | 4 | let store = script.createGuildStorageJson("interval_1"); 5 | script.onInterval("interval_1", "* * * * *", async () => { 6 | if (await store.setIf("has_run", true, "IfNotExists")) { 7 | sendScriptCompletion(script.name); 8 | } 9 | }) -------------------------------------------------------------------------------- /integration-tests/interval2.ts: -------------------------------------------------------------------------------- 1 | import { Storage } from "botloader"; 2 | import { assertElapsed, sendScriptCompletion } from "lib" 3 | 4 | let completed = script.createStorageVarNumber("interval_2_completed"); 5 | let lastRun = script.createStorageVarNumber("interval_2_last"); 6 | 7 | script.onInterval("test2", "* * * * *", async () => { 8 | if (await completed.get()) { 9 | return; 10 | } 11 | 12 | let lr = await lastRun.get() 13 | if (lr) { 14 | assertElapsed(lr.value, 60000); 15 | await completed.set(1); 16 | sendScriptCompletion(script.name); 17 | } else { 18 | await lastRun.set(Date.now()); 19 | } 20 | }) -------------------------------------------------------------------------------- /integration-tests/lib.bl.core.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace BotloaderCore { 2 | export function trackPromise(prom: Promise): any; 3 | } -------------------------------------------------------------------------------- /integration-tests/messagecreate.ts: -------------------------------------------------------------------------------- 1 | import { Discord } from 'botloader'; 2 | import { runOnce, sendScriptCompletion } from 'lib'; 3 | 4 | const testMessageContent = "test message integration test" 5 | script.on("MESSAGE_CREATE", (msg) => { 6 | if (msg.content === testMessageContent) { 7 | sendScriptCompletion(script.name); 8 | } 9 | }) 10 | 11 | runOnce(script.name, async () => { 12 | Discord.createMessage("531120790318350338", { content: testMessageContent }) 13 | }) -------------------------------------------------------------------------------- /integration-tests/messagespam.ts: -------------------------------------------------------------------------------- 1 | import { Discord } from "botloader"; 2 | import { runOnce, sendScriptCompletion } from "lib"; 3 | 4 | runOnce(script.name, async () => { 5 | (async () => { 6 | for (let i = 0; i < 10; i++) { 7 | await Discord.createMessage("531120790318350338", { content: `testing.... ${i}` }) 8 | } 9 | 10 | sendScriptCompletion(script.name); 11 | })(); 12 | }) -------------------------------------------------------------------------------- /integration-tests/permissions2.ts: -------------------------------------------------------------------------------- 1 | import { assertExpected, runOnce, sendScriptCompletion } from "lib"; 2 | import { Discord } from 'botloader'; 3 | 4 | runOnce(script.name, async () => { 5 | let botUser = Discord.getBotUser(); 6 | let guildPerms = await Discord.getMemberGuildPermissions(botUser.id); 7 | console.log("Guild perms: ", guildPerms.value.toString()); 8 | console.log("Guild perms: ", guildPerms.toArray()); 9 | 10 | let channelPerms = await Discord.getMemberChannelPermissions(botUser.id, "968927478775160933"); 11 | console.log("Channel perms, guild: ", channelPerms.guild.toArray()); 12 | console.log("Channel perms, channel: ", channelPerms.channel.toArray()); 13 | 14 | assertExpected(guildPerms.value.toString(), channelPerms.guild.toString()); 15 | 16 | sendScriptCompletion(script.name); 17 | }) -------------------------------------------------------------------------------- /integration-tests/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | cd "${0%/*}" 4 | 5 | export DATABASE_URL=postgres://postgres@localhost/botloader-integration-testing 6 | 7 | # init db 8 | cd ../components/stores 9 | cargo sqlx database reset -y 10 | cd - 11 | 12 | RUST_LOG=info,sqlx=error cargo run --bin prepare-integration-tests -- --scripts-path ./ --guild-id '531120790318350336' $@ 13 | 14 | # run tests 15 | cargo run --bin backend -- full --integration-tests-guild '531120790318350336' -------------------------------------------------------------------------------- /integration-tests/storage_var.ts: -------------------------------------------------------------------------------- 1 | import { assertExpected, runOnce, sendScriptCompletion } from "lib"; 2 | 3 | const counter = script.createStorageVarNumber("storage_var_counter"); 4 | 5 | runOnce(script.name, async () => { 6 | 7 | const entry = await counter.incr(1); 8 | const anotherEntry = await counter.incr(1); 9 | 10 | assertExpected(entry.value + 1, anotherEntry.value); 11 | 12 | await counter.set(100); 13 | let changed = await counter.get(); 14 | assertExpected(100, changed?.value); 15 | 16 | sendScriptCompletion(script.name); 17 | }); 18 | -------------------------------------------------------------------------------- /integration-tests/tasks_data_size.ts: -------------------------------------------------------------------------------- 1 | import { Tasks } from "botloader"; 2 | import { runOnce, sendScriptCompletion } from "lib" 3 | 4 | // this test checks the validation of the max value size 5 | runOnce(script.name, async () => { 6 | 7 | let data: any[] | null = []; 8 | for (let i = 0; i < 1000; i++) { 9 | data.push("0123456789") 10 | } 11 | 12 | try { 13 | await Tasks.schedule("data", new Date(Date.now() + 10000), { 14 | data: data 15 | }); 16 | } catch (e) { 17 | data = null; 18 | sendScriptCompletion(script.name); 19 | return; 20 | } 21 | 22 | throw new Error("expected an error, data validation failed") 23 | }) -------------------------------------------------------------------------------- /integration-tests/tasks_simple_1m.ts: -------------------------------------------------------------------------------- 1 | import { Tasks } from "botloader"; 2 | import { assertElapsed, assetJsonEquals, runOnce, sendScriptCompletion } from "lib" 3 | 4 | interface Data { 5 | someString: string, 6 | someNumber: number, 7 | scheduledAt: number, 8 | }; 9 | 10 | let data: Data = { 11 | someNumber: 1000, 12 | someString: "hello there", 13 | scheduledAt: Date.now(), 14 | } 15 | 16 | script.onTask("simple_1m", (t) => { 17 | assertElapsed(t.data.scheduledAt, 60000); 18 | 19 | data.scheduledAt = t.data.scheduledAt 20 | assetJsonEquals(t.data, data); 21 | 22 | sendScriptCompletion(script.name); 23 | }) 24 | 25 | runOnce(script.name, async () => { 26 | await Tasks.schedule("simple_1m", new Date(data.scheduledAt + 60000), { 27 | data: data 28 | }); 29 | }) -------------------------------------------------------------------------------- /integration-tests/tasks_simple_bucket.ts: -------------------------------------------------------------------------------- 1 | import { assertElapsed, assetJsonEquals, runOnce, sendScriptCompletion } from "lib" 2 | 3 | interface Data { 4 | someString: string, 5 | someNumber: number, 6 | scheduledAt: number, 7 | 8 | }; 9 | 10 | let data: Data = { 11 | someNumber: 1000, 12 | someString: "hello there", 13 | scheduledAt: Date.now(), 14 | } 15 | 16 | const bucket = script.createTaskBucket({ 17 | name: "simple_bucket", 18 | }, (t) => { 19 | console.log("got task!", t.id); 20 | 21 | assertElapsed(t.data.scheduledAt, 10000); 22 | 23 | data.scheduledAt = t.data.scheduledAt; 24 | assetJsonEquals(t.data, data); 25 | 26 | sendScriptCompletion(script.name); 27 | }) 28 | 29 | runOnce(script.name, async () => { 30 | await bucket.schedule({ 31 | executeAt: new Date(data.scheduledAt + 10000), 32 | data, 33 | }) 34 | }) 35 | -------------------------------------------------------------------------------- /integration-tests/test_async_lock.ts: -------------------------------------------------------------------------------- 1 | import { AsyncLock, Discord, Storage } from "botloader"; 2 | import { assertExpected, runOnce, sendScriptCompletion } from "lib"; 3 | 4 | runOnce(script.name, async () => { 5 | 6 | const lock = new AsyncLock() 7 | lock.withLocked(whileLocked) 8 | lock.withLocked(whileLocked) 9 | 10 | sendScriptCompletion(script.name); 11 | 12 | }); 13 | 14 | let someVar = 10 15 | async function whileLocked() { 16 | let copiedVar = someVar 17 | someVar += 10 18 | 19 | // emulate an async operation 20 | await Discord.getMember(Discord.getBotUser().id) 21 | 22 | assertExpected(someVar, copiedVar + 10) 23 | someVar = copiedVar + 20 24 | 25 | await Discord.getMember(Discord.getBotUser().id) 26 | 27 | // ensure it hasn't changed 28 | assertExpected(someVar, copiedVar + 20) 29 | someVar = copiedVar + 30 30 | } -------------------------------------------------------------------------------- /integration-tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "*.ts", 4 | "../components/runtime/src/ts/globals" 5 | ], 6 | "compilerOptions": { 7 | "module": "ES2020", 8 | "noImplicitAny": true, 9 | "removeComments": true, 10 | "preserveConstEnums": true, 11 | "sourceMap": false, 12 | "target": "ES2020", 13 | "alwaysStrict": true, 14 | "strict": true, 15 | "strictNullChecks": true, 16 | "baseUrl": "./", 17 | "lib": [ 18 | "ES2020" 19 | ], 20 | // "typeRoots": [ 21 | // "../typedecls" 22 | // ], 23 | // "rootDirs": [ 24 | // "../typedecls" 25 | // ], 26 | "paths": { 27 | "botloader": [ 28 | "../components/runtime/src/ts/index" 29 | ], 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /notes/README.md: -------------------------------------------------------------------------------- 1 | This directory holds notes and things like that. 2 | -------------------------------------------------------------------------------- /notes/plugins.md: -------------------------------------------------------------------------------- 1 | **blcmd** 2 | 3 | Command line option replacing most of the functionality in the vscode plugin. 4 | 5 | For now, only needs the plugin specific stuff. 6 | 7 | Sub sections: 8 | 9 | - http api client 10 | - config loading/saving from logging in 11 | 12 | **new database tables** 13 | 14 | - Plugins table 15 | - Versions table 16 | - A version of the plugin, along with all the plugin data in a tarball(?) 17 | - Probably filter out only the needed contents for the tarball, ts files and 18 | the botloader-plugin.json file 19 | - 3 version types, stable, pre-release, development (rapidly changing, only 20 | last one kept) 21 | - GuildPlugins table 22 | - Holds the plugins the guild has added to it along with their version 23 | 24 | **support in vmworker and scheduler** 25 | 26 | - GuildHandler, maybe split up worker sessions or vm sessions into their own 27 | thing? 28 | -------------------------------------------------------------------------------- /rt-changelog-breaking.md: -------------------------------------------------------------------------------- 1 | # Pending release 2 | 3 | - Variants of many discord types have a new `"Unknown"` or `{Unknown: number}` variant, this is for future proofing for when discord adds new types 4 | - New `UnknownChannel` type 5 | - `Channel.position` changed to `number` from `bigint` 6 | --------------------------------------------------------------------------------