diff --git a/app/app.ts b/app/app.ts index 54f635e..e1e6aba 100644 --- a/app/app.ts +++ b/app/app.ts @@ -11,6 +11,10 @@ export const SHORTER_DESTINATION = "destination"; export const SHORTER_DESTINATION_DESCRIPTION = "The destination of the shortlink."; +export const SHORTER_FORCE = "force"; +export const SHORTER_FORCE_DESCRIPTION = + "Whether to overwrite an existing shortlink."; + /** * APP_SHORTER is the top-level command for the Shorter Application Command. */ @@ -31,5 +35,11 @@ export const APP_SHORTER: discord.RESTPostAPIApplicationCommandsJSONBody = { description: SHORTER_DESTINATION_DESCRIPTION, required: true, }, + { + type: discord.ApplicationCommandOptionType.Boolean, + name: SHORTER_FORCE, + description: SHORTER_FORCE_DESCRIPTION, + required: false, + }, ], }; diff --git a/deno.lock b/deno.lock index 272d256..eef2c47 100644 --- a/deno.lock +++ b/deno.lock @@ -1,12 +1,12 @@ { - "version": "2", + "version": "3", "remote": { "https://deno.land/std@0.191.0/collections/filter_values.ts": "5b9feaf17b9a6e5ffccdd36cf6f38fa4ffa94cff2602d381c2ad0c2a97929652", "https://deno.land/std@0.191.0/collections/without_all.ts": "a89f5da0b5830defed4f59666e188df411d8fece35a5f6ca69be6ca71a95c185", "https://deno.land/std@0.191.0/dotenv/mod.ts": "f5a8123741d1561ae8184a7f043bc097b15132c5171c651142b804b6dbc21853", "https://deno.land/std@0.191.0/http/http_errors.ts": "b9a18ef97d6c5966964de95e04d1f9f88a0f8bd8577c26fd402d9d632fb03a42", "https://deno.land/std@0.191.0/http/http_status.ts": "8a7bcfe3ac025199ad804075385e57f63d055b2aed539d943ccc277616d6f932", - "https://deno.land/std@0.201.0/dotenv/mod.ts": "1da8c6d0e7f7d8a5c2b19400b763bc11739df24acec235dda7ea2cfd3d300057", + "https://deno.land/std@0.203.0/dotenv/mod.ts": "1da8c6d0e7f7d8a5c2b19400b763bc11739df24acec235dda7ea2cfd3d300057", "https://deno.land/x/codemod@0.0.5/deps.ts": "5e27f88433fb872ab1873b104c4301825d2d16c5c37165a7b989a71e62ae908a", "https://deno.land/x/codemod@0.0.5/github/api/github_api_client.ts": "0574f97e834c215f6151e420cf821bceb745750a7a4d4fcc60eb897b486d1f98", "https://deno.land/x/codemod@0.0.5/github/api/github_api_client_interface.ts": "16e7466539ad7f50dc6fa2a3d1fcdee4407336ffb94643ab3e783e76f03e309b", @@ -35,82 +35,82 @@ "https://deno.land/x/codemod@0.0.5/github/tree/base64.ts": "4854bba36ec3fc501693d27cece4f5725797b522cd7dfe0c721befedefd956f3", "https://deno.land/x/codemod@0.0.5/github/tree/github_create_tree_builder.ts": "cc3d4efa23ecce94eb1b3dbaf8cdd16dff3a14065335302365009df5a20a7c17", "https://deno.land/x/codemod@0.0.5/github/tree/github_create_tree_builder_interface.ts": "0623f3c8a5285b58898555c2718cd2f7ec6e1d5619ee30405ef3297d5ea8802b", - "https://deno.land/x/discord_api_types@0.37.56/gateway/common.ts": "fb67003adda424df76c2726e0624d709c5a16e3694d6b75facd587d121fe121f", - "https://deno.land/x/discord_api_types@0.37.56/gateway/v10.ts": "1b0fa3d040825a7aab93d6acec63d457c79c445dcc934d4f511dc2c326988ddf", - "https://deno.land/x/discord_api_types@0.37.56/globals.ts": "7d8879654c4741ac071668ad52f2659bcdb66694cfe7da306c8437ec752807a7", - "https://deno.land/x/discord_api_types@0.37.56/payloads/common.ts": "7c42a7965f38d82d9a425cf732ff0d4d2b5370568168d5fa41f138fd8ab4c693", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/attachment.ts": "c66dccd54c1b84d073f2e1caa466e551b8045a84a2e8a88a1bfbc7e2c64a703d", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/base.ts": "f6a2556e14d489e1f0e5ddeb3a0303e2603e25330530dd9263e176013c5f51eb", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/boolean.ts": "65e29561b61785ca4ede4b1b4a88c5fc0696cfdf1fa74d5197588c196ee7ae98", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/channel.ts": "73c7fc49de242e1ce3be958375fd810750aed83553ef3860e3cddf858f9eb464", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/integer.ts": "a25d24a3e54d647c7039b99e3208fc0fc2228d174f6dcc421e93919b8154a011", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/mentionable.ts": "742e42857465866e0c08b587d7fb5ccd81d4705c61ce4cd6b97ad5692e88e969", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/number.ts": "be974ea68f5fdf55d7a7f5d3faf48a3193777d432b1aa9087afc204bcb916284", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/role.ts": "a57114d0f7eeee4ab7cf217a865dd9dbd9096d007c556aec6185d64257100f41", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts": "9e2d3b3530280f6de5f9b6de1bb81e8a905998e058f784a9b041e48a96cd93d2", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/string.ts": "33ab12dab64544a70729b9b66b5a9790964ea779f05d4ab1a1e190e7c1b59e98", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/subcommand.ts": "0013737da6d2b54e2f413fbf31cf9c84ea51bd9204b615cb4fd19b420f856cb2", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/subcommandGroup.ts": "db5cc701bcb3d68c094de409da39c9a2b8834dc0d5038e5f963c96e5eaf412ac", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/_chatInput/user.ts": "ed2871693744298225ba53ddfb18d3e7afff20a34f413822d5b1193918aea27f", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/chatInput.ts": "46362da4e56c99cc69331481330d6e95c31d5e46f4cc36ec23f03cafbb687d52", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/contextMenu.ts": "89aed5f05f75d482e40259f55d0172143a90c1980d060d16545bdc14b68b29c4", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/internals.ts": "5eb5ea13a1247c73c0611886dea09ab8d632a9c5555ff0f33d44cd379fd75a08", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/_applicationCommands/permissions.ts": "ddca14b62e6afd418c1417117ffcc7cfb2ea5e5cc5353b4a0598435bdea45fb5", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/applicationCommands.ts": "b0646f2930d38113389bd1ecf8c605ac5af8fc40f93fafd17f968150419fac14", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/autocomplete.ts": "821ae50ff9845cac4b03169dbd4c4b187d8399765eb1f0d658d477c68e4c6136", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/base.ts": "c839d953bf7f7912aa7202e7586d65aafb7f90d22aedd21a13586295c62f2bdf", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/messageComponents.ts": "08faa77d1c1d9a33359a962b78b695304e27cb6435af319b41e9a9d3b395adb2", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/modalSubmit.ts": "3a02d2d7df5bcdb1ffcd089f15e0d82ab65dcc0cefa904c6e0621f46edac041e", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/ping.ts": "096ce582e9af373649fd5355cccd7424adceaffb73367b5301f1594ef5a3c264", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/_interactions/responses.ts": "0a607a78dd08a498c3b523a922c51ec9465021d98b3a21b7c7551524d49d70ce", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/application.ts": "69e8470289fcde7ec1483600540085e402a11b21cfeab2191db23dd387452ee7", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/auditLog.ts": "0a538dd3e4876ec741a6986afc1057589f43d3efd1684386346317801c53268d", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/autoModeration.ts": "9ccb4408f1c6392d9619fac159997e08e660080b3f9567a1619163a40329e3a2", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/channel.ts": "60ba55624295d4717db5330bd503cbd6c2da6dc68cb850505d4eca8ef6ac5c39", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/emoji.ts": "b9a30b16e1ec4dc15d6149e59aa48b02ad57a51335b7be5a7f5368db0491b3dd", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/gateway.ts": "4ce715fa94eadf5e2ba6adfc4a3bf99bac5d19c4787794ee1774b645a324db72", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/guild.ts": "536ce0d73d055290855febb556d6ffcc3308f5824887879d28f49d0e4a676fa6", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/guildScheduledEvent.ts": "bf506b7807501b71077751ec793e719c5515e1bb405dec5cc4371a61b03cf8b9", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/interactions.ts": "17dabe94016dad3d0d7fdc0aa812bf5b0b366465dd72cd0b01168880778cc60d", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/invite.ts": "92c09f549482a4e2ad5a3c1062debfb262c6fe4b6740581175a0b8108873ab01", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/mod.ts": "733090e3f67bb812dc0a3986d476e62483e88dfa0ce362d048a669b54b94c625", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/oauth2.ts": "dfb9f09fb44bf5faaa73ad4488ebe408905907d5fd46404895317f4e7c378489", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/permissions.ts": "5e7990e6dad3e35f8c130dc52de4bbf63afe5d6ad98e1c56b09da3ead94ad5a4", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/stageInstance.ts": "f0b9ee8c24c67298086fa32cb0595f6c29710d81b6fe85b958d48e6c549c4cb8", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/sticker.ts": "8511b5cdbe8289ce13fd51c2e96d24548345111b8d9f9c907dd3336f10e795bf", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/teams.ts": "101044d8c48a3cbabb60048eff9f69588bdd1ea84d1825de0372b4e23ad7ccbe", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/template.ts": "c6bee171ed0ce61fc8b59de42541a023bdcde62718deb42325397e5c82efdc27", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/user.ts": "59706244399f29512688c0813ec7dbaabd2fd5f583471564ff513e87213d2d13", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/voice.ts": "62d03a540f2e78e5f3989f71a0ee1ec682ef7306a4fa096f89118cbd82351d47", - "https://deno.land/x/discord_api_types@0.37.56/payloads/v10/webhook.ts": "7fc370f40a84f12a6e57ddda7cf2814f15039d6320b46979db0b49d5b91e303b", - "https://deno.land/x/discord_api_types@0.37.56/rest/common.ts": "0bfbcf97482fe86daeb68c57885bd04a7d6504ba9037f7e533ea466825afd051", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/application.ts": "5b44ce90cf739aac76e2f01c15a3d4a03724703695235aec4f800fdd08782ec0", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/auditLog.ts": "39a0914b6c51445023d82c3e3e66c9866cbb3cb6774d3e7eac63414ea9bcbfec", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/autoModeration.ts": "3d388fd9a91c34f04b5e3e1b6ffe12029fb48b511f37ff88042325ec6cbc6605", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/channel.ts": "76adde119c0f1fe0114269766c1f15db482d88911c2a1682090388a07a9c3209", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/emoji.ts": "9f694a1bd63886c62a87b4320f3bfa5d4f534b2d87c317d77d572d10522df3aa", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/gateway.ts": "747cb95c9a8bca4e52423c780d5fc492fb0dab2b6015cd7e51e890e8d51acf29", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/guild.ts": "89d448eb50f891d19034480b45bc7e038c0712a0cc9b102b524b5d1f254f5b70", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/guildScheduledEvent.ts": "29d361f395d8cd1ecb47550615d19e10793d513cc5ad8d32895da2cc9cd0fd89", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/interactions.ts": "2b6decdfff921b6aa8f0e6e5c61d38469a0178c5ecf1a18dd17ad6738143e662", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/invite.ts": "28f8e740bdaa782c9d9d504049323762b5c1180348019dc5f9e0a900ec11213e", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/mod.ts": "eb7e802fc0d134d862f9b5eef57a9cd7f536ce09c1ca5e8809f09ff9ef4e9eeb", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/oauth2.ts": "b659a35654c17767480d142c46c36f5fe2544346875745e3f654c5e7c3d9f3f9", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/stageInstance.ts": "d5d96446a0275860f136d40546bf0519d5d8d4171d03058598559df095dbf899", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/sticker.ts": "1f7f2729308a0ec1fe373b5df7ac71bafc200132f1a06df7e75bf5ce1d1069c1", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/template.ts": "0ad41c3c85571d3c5b0bec3914c678a21f376ec162ef0d3f1f7731a8d1d1009c", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/user.ts": "60cfa227426c791021e9e8f769287e997477e722db5a3c577a9ec54078aaffca", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/voice.ts": "cdbe9d6c39c8f44635d8632bf62a95b8c15877b92c56ddf69df2072bb1a74edc", - "https://deno.land/x/discord_api_types@0.37.56/rest/v10/webhook.ts": "f4d47265bc69f9fa32efd0fd620db8b1d1996d2184cf5ac624abd104862d6ae0", - "https://deno.land/x/discord_api_types@0.37.56/rpc/common.ts": "a693352ffd86ae9e995fb3fbfbfd2be30896257ecb83c5611050f060b08de4ef", - "https://deno.land/x/discord_api_types@0.37.56/rpc/v10.ts": "fbaad9f3d73fce88e76b0e52ad5345093f18077e4293937c9ec0ee24415b9a93", - "https://deno.land/x/discord_api_types@0.37.56/utils/internals.ts": "cb70895ba89f7947c38f7fa447b0190cb14b5585be323414cda53d2ccb19b16c", - "https://deno.land/x/discord_api_types@0.37.56/utils/v10.ts": "056bd036f8c65365ff28eb63ec6897811d51921cca6d068392dd1ca5b397ae62", - "https://deno.land/x/discord_api_types@0.37.56/v10.ts": "f3f23492c59e77859aba5b34431edf3668c37f722d7f70c2e1ef7ba4bcda3010", + "https://deno.land/x/discord_api_types@0.37.58/gateway/common.ts": "fb67003adda424df76c2726e0624d709c5a16e3694d6b75facd587d121fe121f", + "https://deno.land/x/discord_api_types@0.37.58/gateway/v10.ts": "1b0fa3d040825a7aab93d6acec63d457c79c445dcc934d4f511dc2c326988ddf", + "https://deno.land/x/discord_api_types@0.37.58/globals.ts": "7d8879654c4741ac071668ad52f2659bcdb66694cfe7da306c8437ec752807a7", + "https://deno.land/x/discord_api_types@0.37.58/payloads/common.ts": "7c42a7965f38d82d9a425cf732ff0d4d2b5370568168d5fa41f138fd8ab4c693", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/attachment.ts": "c66dccd54c1b84d073f2e1caa466e551b8045a84a2e8a88a1bfbc7e2c64a703d", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/base.ts": "f6a2556e14d489e1f0e5ddeb3a0303e2603e25330530dd9263e176013c5f51eb", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/boolean.ts": "65e29561b61785ca4ede4b1b4a88c5fc0696cfdf1fa74d5197588c196ee7ae98", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/channel.ts": "73c7fc49de242e1ce3be958375fd810750aed83553ef3860e3cddf858f9eb464", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/integer.ts": "a25d24a3e54d647c7039b99e3208fc0fc2228d174f6dcc421e93919b8154a011", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/mentionable.ts": "742e42857465866e0c08b587d7fb5ccd81d4705c61ce4cd6b97ad5692e88e969", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/number.ts": "be974ea68f5fdf55d7a7f5d3faf48a3193777d432b1aa9087afc204bcb916284", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/role.ts": "a57114d0f7eeee4ab7cf217a865dd9dbd9096d007c556aec6185d64257100f41", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts": "9e2d3b3530280f6de5f9b6de1bb81e8a905998e058f784a9b041e48a96cd93d2", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/string.ts": "33ab12dab64544a70729b9b66b5a9790964ea779f05d4ab1a1e190e7c1b59e98", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/subcommand.ts": "0013737da6d2b54e2f413fbf31cf9c84ea51bd9204b615cb4fd19b420f856cb2", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/subcommandGroup.ts": "db5cc701bcb3d68c094de409da39c9a2b8834dc0d5038e5f963c96e5eaf412ac", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/_chatInput/user.ts": "ed2871693744298225ba53ddfb18d3e7afff20a34f413822d5b1193918aea27f", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/chatInput.ts": "46362da4e56c99cc69331481330d6e95c31d5e46f4cc36ec23f03cafbb687d52", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/contextMenu.ts": "89aed5f05f75d482e40259f55d0172143a90c1980d060d16545bdc14b68b29c4", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/internals.ts": "5eb5ea13a1247c73c0611886dea09ab8d632a9c5555ff0f33d44cd379fd75a08", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/_applicationCommands/permissions.ts": "ddca14b62e6afd418c1417117ffcc7cfb2ea5e5cc5353b4a0598435bdea45fb5", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/applicationCommands.ts": "b0646f2930d38113389bd1ecf8c605ac5af8fc40f93fafd17f968150419fac14", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/autocomplete.ts": "821ae50ff9845cac4b03169dbd4c4b187d8399765eb1f0d658d477c68e4c6136", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/base.ts": "13b9399fae286ad7b80181f116c18c0bcefe30121d90a76a1d7ae0c7ac46e14b", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/messageComponents.ts": "08faa77d1c1d9a33359a962b78b695304e27cb6435af319b41e9a9d3b395adb2", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/modalSubmit.ts": "3a02d2d7df5bcdb1ffcd089f15e0d82ab65dcc0cefa904c6e0621f46edac041e", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/ping.ts": "096ce582e9af373649fd5355cccd7424adceaffb73367b5301f1594ef5a3c264", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/_interactions/responses.ts": "0a607a78dd08a498c3b523a922c51ec9465021d98b3a21b7c7551524d49d70ce", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/application.ts": "69e8470289fcde7ec1483600540085e402a11b21cfeab2191db23dd387452ee7", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/auditLog.ts": "ced9d28a20b2bb201761c37ef266ace325a808a405b7472d70ad6df3b56c4d87", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/autoModeration.ts": "9ccb4408f1c6392d9619fac159997e08e660080b3f9567a1619163a40329e3a2", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/channel.ts": "2d5168c85de11cb82503390aa6e49e20ea4bb806d010762cc3a4b1ece09b696a", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/emoji.ts": "b9a30b16e1ec4dc15d6149e59aa48b02ad57a51335b7be5a7f5368db0491b3dd", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/gateway.ts": "4ce715fa94eadf5e2ba6adfc4a3bf99bac5d19c4787794ee1774b645a324db72", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/guild.ts": "4c03e054fc07d8db0ee7fa2b6f645f57f7642de0d28a704aa15047a51544f710", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/guildScheduledEvent.ts": "bf506b7807501b71077751ec793e719c5515e1bb405dec5cc4371a61b03cf8b9", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/interactions.ts": "17dabe94016dad3d0d7fdc0aa812bf5b0b366465dd72cd0b01168880778cc60d", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/invite.ts": "92c09f549482a4e2ad5a3c1062debfb262c6fe4b6740581175a0b8108873ab01", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/mod.ts": "733090e3f67bb812dc0a3986d476e62483e88dfa0ce362d048a669b54b94c625", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/oauth2.ts": "dfb9f09fb44bf5faaa73ad4488ebe408905907d5fd46404895317f4e7c378489", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/permissions.ts": "5e7990e6dad3e35f8c130dc52de4bbf63afe5d6ad98e1c56b09da3ead94ad5a4", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/stageInstance.ts": "f0b9ee8c24c67298086fa32cb0595f6c29710d81b6fe85b958d48e6c549c4cb8", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/sticker.ts": "8511b5cdbe8289ce13fd51c2e96d24548345111b8d9f9c907dd3336f10e795bf", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/teams.ts": "101044d8c48a3cbabb60048eff9f69588bdd1ea84d1825de0372b4e23ad7ccbe", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/template.ts": "c6bee171ed0ce61fc8b59de42541a023bdcde62718deb42325397e5c82efdc27", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/user.ts": "361b93e3683fcf611c021c4f39c7501ca1482e999887d97a4b0a09398b4618c5", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/voice.ts": "62d03a540f2e78e5f3989f71a0ee1ec682ef7306a4fa096f89118cbd82351d47", + "https://deno.land/x/discord_api_types@0.37.58/payloads/v10/webhook.ts": "7fc370f40a84f12a6e57ddda7cf2814f15039d6320b46979db0b49d5b91e303b", + "https://deno.land/x/discord_api_types@0.37.58/rest/common.ts": "0bfbcf97482fe86daeb68c57885bd04a7d6504ba9037f7e533ea466825afd051", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/application.ts": "5b44ce90cf739aac76e2f01c15a3d4a03724703695235aec4f800fdd08782ec0", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/auditLog.ts": "39a0914b6c51445023d82c3e3e66c9866cbb3cb6774d3e7eac63414ea9bcbfec", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/autoModeration.ts": "3d388fd9a91c34f04b5e3e1b6ffe12029fb48b511f37ff88042325ec6cbc6605", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/channel.ts": "421ab1178e83765fe403c75b8e481823bd10a9288c1487163c4f1b5049d2ca7c", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/emoji.ts": "9f694a1bd63886c62a87b4320f3bfa5d4f534b2d87c317d77d572d10522df3aa", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/gateway.ts": "747cb95c9a8bca4e52423c780d5fc492fb0dab2b6015cd7e51e890e8d51acf29", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/guild.ts": "89d448eb50f891d19034480b45bc7e038c0712a0cc9b102b524b5d1f254f5b70", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/guildScheduledEvent.ts": "29d361f395d8cd1ecb47550615d19e10793d513cc5ad8d32895da2cc9cd0fd89", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/interactions.ts": "2b6decdfff921b6aa8f0e6e5c61d38469a0178c5ecf1a18dd17ad6738143e662", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/invite.ts": "28f8e740bdaa782c9d9d504049323762b5c1180348019dc5f9e0a900ec11213e", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/mod.ts": "eb7e802fc0d134d862f9b5eef57a9cd7f536ce09c1ca5e8809f09ff9ef4e9eeb", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/oauth2.ts": "b659a35654c17767480d142c46c36f5fe2544346875745e3f654c5e7c3d9f3f9", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/stageInstance.ts": "d5d96446a0275860f136d40546bf0519d5d8d4171d03058598559df095dbf899", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/sticker.ts": "1f7f2729308a0ec1fe373b5df7ac71bafc200132f1a06df7e75bf5ce1d1069c1", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/template.ts": "0ad41c3c85571d3c5b0bec3914c678a21f376ec162ef0d3f1f7731a8d1d1009c", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/user.ts": "60cfa227426c791021e9e8f769287e997477e722db5a3c577a9ec54078aaffca", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/voice.ts": "cdbe9d6c39c8f44635d8632bf62a95b8c15877b92c56ddf69df2072bb1a74edc", + "https://deno.land/x/discord_api_types@0.37.58/rest/v10/webhook.ts": "f4d47265bc69f9fa32efd0fd620db8b1d1996d2184cf5ac624abd104862d6ae0", + "https://deno.land/x/discord_api_types@0.37.58/rpc/common.ts": "a693352ffd86ae9e995fb3fbfbfd2be30896257ecb83c5611050f060b08de4ef", + "https://deno.land/x/discord_api_types@0.37.58/rpc/v10.ts": "fbaad9f3d73fce88e76b0e52ad5345093f18077e4293937c9ec0ee24415b9a93", + "https://deno.land/x/discord_api_types@0.37.58/utils/internals.ts": "cb70895ba89f7947c38f7fa447b0190cb14b5585be323414cda53d2ccb19b16c", + "https://deno.land/x/discord_api_types@0.37.58/utils/v10.ts": "056bd036f8c65365ff28eb63ec6897811d51921cca6d068392dd1ca5b397ae62", + "https://deno.land/x/discord_api_types@0.37.58/v10.ts": "f3f23492c59e77859aba5b34431edf3668c37f722d7f70c2e1ef7ba4bcda3010", "https://deno.land/x/github_api_types@2023-05-17-05-41/mod.ts": "dc3a5cd3176c78085b49601e9c3fccac24809b037929230293255edabafbd0bb", - "https://esm.sh/fast-json-patch@3.1.1": "f4e016bd7e4966152802d731fd0c61c87c221e4c511568c9253c6e0cfa024692", - "https://esm.sh/tweetnacl@1.0.3": "6a8b605602fd069e53a36f008025d64ea57a6cab6280c835bac070442359b49f", - "https://esm.sh/v132/fast-json-patch@3.1.1/denonext/fast-json-patch.mjs": "9007860190336aa381bde2411eb991d3d70fe378c0cc204f099d4fc9bd6b7619", - "https://esm.sh/v132/tweetnacl@1.0.3/denonext/tweetnacl.mjs": "75e9a8900d060c3ca95751fba891f56539b2f07b584240e89e6069dd11b8af31" + "https://esm.sh/fast-json-patch@3.1.1": "fd59bab1fabdb3e7e2ce8204aa92113dc451708797021fff6f96b8ff265faedf", + "https://esm.sh/tweetnacl@1.0.3": "fe5086fc2857018dc6118351ec0790016454d787af13301d65331c9a08eabb6a", + "https://esm.sh/v124/fast-json-patch@3.1.1/deno/fast-json-patch.mjs": "19183b256388e7af3ffb65022a634e00109c308fe79071cd550dd5ab1f0a571b", + "https://esm.sh/v125/tweetnacl@1.0.3/denonext/tweetnacl.mjs": "e3f326d197a7d2dc580dc57db86b5adb6374d9a64de2d5b6a1711612c930c1c7" } } diff --git a/deps.ts b/deps.ts index e43563c..c611672 100644 --- a/deps.ts +++ b/deps.ts @@ -1,5 +1,5 @@ -export * as dotenv from "https://deno.land/std@0.201.0/dotenv/mod.ts"; -export * as discord from "https://deno.land/x/discord_api_types@0.37.56/v10.ts"; +export * as dotenv from "https://deno.land/std@0.203.0/dotenv/mod.ts"; +export * as discord from "https://deno.land/x/discord_api_types@0.37.58/v10.ts"; export * from "https://deno.land/x/codemod@0.0.5/github/mod.ts"; export type { GitHubAPIClientOptions } from "https://deno.land/x/codemod@0.0.5/github/api/mod.ts"; export { default as nacl } from "https://esm.sh/tweetnacl@1.0.3"; diff --git a/main.ts b/main.ts index e7f2dff..a739cb5 100644 --- a/main.ts +++ b/main.ts @@ -6,7 +6,12 @@ import { discord } from "./deps.ts"; import { DiscordAPIClient, verify } from "./discord/mod.ts"; -import { APP_SHORTER, SHORTER_ALIAS, SHORTER_DESTINATION } from "./app/mod.ts"; +import { + APP_SHORTER, + SHORTER_ALIAS, + SHORTER_DESTINATION, + SHORTER_FORCE, +} from "./app/mod.ts"; import type { ShorterOptions } from "./shorter.ts"; import { shorter } from "./shorter.ts"; import * as env from "./env.ts"; @@ -144,6 +149,12 @@ export function makeShorterOptions( throw new Error("Invalid destination"); } + const forceOption = data.options + ?.find((option) => option.name === SHORTER_FORCE); + if (forceOption?.type !== discord.ApplicationCommandOptionType.Boolean) { + throw new Error("Invalid force"); + } + return { githubPAT: env.GITHUB_TOKEN, actor: { @@ -153,6 +164,7 @@ export function makeShorterOptions( data: { alias: aliasOption.value, destination: destinationOption.value, + force: forceOption.value, }, }; } diff --git a/shorter.ts b/shorter.ts index 3c12570..ce73515 100644 --- a/shorter.ts +++ b/shorter.ts @@ -13,7 +13,7 @@ export async function shorter(options: ShorterOptions): Promise { .text(ACMCSUF_LINKS_PATH, (text) => { const data = JSON.parse(text); const isAliasTaken = data[options.data.alias] !== undefined; - if (isAliasTaken) { + if (!options.data.force && isAliasTaken) { throw new Error( `the alias \`${options.data.alias}\` already exists`, ); @@ -80,6 +80,11 @@ export interface ShorterOptions { * destination is the destination location. */ destination: string; + + /** + * force is whether to overwrite an existing shortlink. + */ + force?: boolean; }; }