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/unfollow.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 interactWithBlueskyNow from "#utils/interact-with-bluesky-now.js";

const unlikeNowCommand = new Command({
name: "unfollow",
description: "Unfollow an account on Bluesky.",
options: [
{
type: ApplicationCommandOptionTypes.STRING,
name: "handle",
description: "What's the name of the account?",
required: true
}
],
async action(interaction) {

return await interactWithBlueskyNow(interaction, "unfollow", "deleteFollow");

}
});

export default unlikeNowCommand;
5 changes: 3 additions & 2 deletions src/utils/interact-with-bluesky-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 interactWithBlueskyNow(interaction: CommandInteraction | ComponentInteraction | ModalSubmitInteraction, customIDPrefix: string, action: "follow" | "deleteRepost" | "like" | "deleteLike" | "repost") {
async function interactWithBlueskyNow(interaction: CommandInteraction | ComponentInteraction | ModalSubmitInteraction, customIDPrefix: string, action: "deleteFollow" | "follow" | "deleteRepost" | "like" | "deleteLike" | "repost") {

const guildID = getGuildIDFromInteraction(interaction);

Expand All @@ -26,7 +26,8 @@ async function interactWithBlueskyNow(interaction: CommandInteraction | Componen
like: "💖",
deleteLike: "💔",
deleteRepost: "🗑️",
follow: "➕"
follow: "➕",
deleteFollow: "➖"
};
await interaction.editOriginal({
content: responses[action],
Expand Down
2 changes: 1 addition & 1 deletion src/utils/interact-with-bluesky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import blueskyClient from "./bluesky-client.js";
import { Agent } from "@atproto/api";
import { isThreadViewPost } from "@atproto/api/dist/client/types/app/bsky/feed/defs.js";

async function interactWithBluesky(source: {interaction?: ModalSubmitInteraction | ComponentInteraction, rkey?: string, targetHandle?: string, actorDID?: string, guildID: string, decryptionKey?: string}, action: "follow" | "deletePost" | "deleteLike" | "like" | "deleteRepost" | "repost") {
async function interactWithBluesky(source: {interaction?: ModalSubmitInteraction | ComponentInteraction, rkey?: string, targetHandle?: string, actorDID?: string, guildID: string, decryptionKey?: string}, action: "deleteFollow" | "follow" | "deletePost" | "deleteLike" | "like" | "deleteRepost" | "repost") {

let {interaction, rkey, targetHandle, actorDID} = source;

Expand Down
Loading