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/unmute.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 unmuteNowCommand = new Command({
name: "unmute",
description: "Unmute 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, "unmute", "unmute");

}
});

export default unmuteNowCommand;
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: "mute" | "deleteFollow" | "follow" | "deleteRepost" | "like" | "deleteLike" | "repost") {
async function interactWithBlueskyNow(interaction: CommandInteraction | ComponentInteraction | ModalSubmitInteraction, customIDPrefix: string, action: "unmute" | "mute" | "deleteFollow" | "follow" | "deleteRepost" | "like" | "deleteLike" | "repost") {

const guildID = getGuildIDFromInteraction(interaction);

Expand All @@ -28,7 +28,8 @@ async function interactWithBlueskyNow(interaction: CommandInteraction | Componen
deleteRepost: "🗑️",
follow: "➕",
deleteFollow: "➖",
mute: "🔕"
mute: "🔕",
unmute: "🔔"
};
await interaction.editOriginal({
content: responses[action],
Expand Down
5 changes: 3 additions & 2 deletions src/utils/interact-with-bluesky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ 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: "mute" | "deleteFollow" | "follow" | "deletePost" | "deleteLike" | "like" | "deleteRepost" | "repost") {
async function interactWithBluesky(source: {interaction?: ModalSubmitInteraction | ComponentInteraction, rkey?: string, targetHandle?: string, actorDID?: string, guildID: string, decryptionKey?: string}, action: "unmute" | "mute" | "deleteFollow" | "follow" | "deletePost" | "deleteLike" | "like" | "deleteRepost" | "repost") {

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

const isTargetAccount = action === "deleteFollow" || action === "follow" || action === "mute";
const accountActionTypes = ["deleteFollow", "follow", "mute", "unmute"];
const isTargetAccount = accountActionTypes.includes(action);
if (interaction && !targetHandle) {

// Get the rkey of the post.
Expand Down
Loading