Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions src/commands/unrepost.ts
Original file line number Diff line number Diff line change
@@ -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;
7 changes: 4 additions & 3 deletions src/utils/interact-with-post-now.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -24,8 +24,9 @@ async function interactWithPostNow(interaction: CommandInteraction | ComponentIn
const responses = {
repost: "♻️",
like: "💖",
deleteLike: "💔"
}
deleteLike: "💔",
deleteRepost: "🗑️"
};
await interaction.editOriginal({
content: responses[action],
components: [],
Expand Down
Loading