diff --git a/src/commands/unrepost.ts b/src/commands/unrepost.ts new file mode 100644 index 0000000..7c269e6 --- /dev/null +++ b/src/commands/unrepost.ts @@ -0,0 +1,23 @@ +import Command from "#utils/Command.js" +import { ApplicationCommandOptionTypes } from "oceanic.js"; +import interactWithPostNow from "#utils/interact-with-post-now.js"; + +const unrepostNowCommand = new Command({ + name: "unrepost", + description: "Unrepost a post on Bluesky.", + options: [ + { + type: ApplicationCommandOptionTypes.STRING, + name: "link", + description: "What's the link of the post?", + required: true + } + ], + async action(interaction) { + + return await interactWithPostNow(interaction, "unrepost", "deleteRepost"); + + } +}); + +export default unrepostNowCommand; \ No newline at end of file diff --git a/src/utils/interact-with-post-now.ts b/src/utils/interact-with-post-now.ts index df7178e..a0c2bb7 100644 --- a/src/utils/interact-with-post-now.ts +++ b/src/utils/interact-with-post-now.ts @@ -11,7 +11,7 @@ import { authenticator } from "otplib"; import IncorrectDecryptionKeyError from "./errors/IncorrectDecryptionKeyError.js"; import MFAIncorrectCodeError from "./errors/MFAIncorrectCodeError.js"; -async function interactWithPostNow(interaction: CommandInteraction | ComponentInteraction | ModalSubmitInteraction, customIDPrefix: string, action: "like" | "deleteLike" | "repost") { +async function interactWithPostNow(interaction: CommandInteraction | ComponentInteraction | ModalSubmitInteraction, customIDPrefix: string, action: "deleteRepost" | "like" | "deleteLike" | "repost") { const guildID = getGuildIDFromInteraction(interaction); @@ -24,8 +24,9 @@ async function interactWithPostNow(interaction: CommandInteraction | ComponentIn const responses = { repost: "♻️", like: "💖", - deleteLike: "💔" - } + deleteLike: "💔", + deleteRepost: "🗑️" + }; await interaction.editOriginal({ content: responses[action], components: [],