Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | import { CommandConfig, CommandPermissions, ValidatedOptions } from "@/common/decorators"; import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { Buttons } from "@/modules/bot/components/Buttons.component"; import { Extends } from "@/types/Constants"; import { Inject, Injectable, Logger, UseGuards } from "@nestjs/common"; import { Client, TextChannel } from "discord.js"; import { Ctx, SlashCommandContext, Subcommand } from "necord"; import type { IReactionRolesEmbeds, IReactionRolesService } from "../../interfaces"; import { ReactionRoles } from "../../types/constants"; import { EditReactionDTO } from "./EditReaction.dto"; @Injectable() export class EditReactionCommand { public constructor( @Inject(ReactionRoles.Service) private readonly reaction: IReactionRolesService, @Inject(ReactionRoles.Embeds) private readonly Embeds: IReactionRolesEmbeds, @Inject(Extends.Buttons) private readonly Buttons: Buttons, private readonly client: Client, ) {} private readonly logger = new Logger(EditReactionCommand.name); @Subcommand({ name: "edit", description: "", }) @CommandConfig({ category: "🎩 ReactionRole", disable: false }) @CommandPermissions({ user: ["SendMessages", "AddReactions", "ManageRoles"], bot: ["EmbedLinks", "AddReactions", "ManageRoles"], guildOnly: false, ownerOnly: false, }) @UseGuards(CommandConfigGuard, CommandPermissionsGuard) public async onCommandRun(@Ctx() [interaction]: SlashCommandContext, @ValidatedOptions() dto: EditReactionDTO) { const Channel = dto.channel as TextChannel; const MessageID = dto.messageId; const Message = await Channel.messages.fetch(MessageID); const Role = dto.role; const Emoji = dto.emoji; await this.reaction.CheckParams(this.client, interaction, Channel, MessageID, Message, Role, Emoji); const REACT = await this.reaction.Delete(interaction.guild, { Channel: Channel.id, Message: Message.id, Role: Role.id, Emoji, }); if (REACT.status === "Deleted") { await interaction.reply({ embeds: [await this.Embeds.ReactionRoleRemovedEmbed(interaction, Message)] }); await Message.reactions.cache.get(Emoji).remove(); } else { interaction.reply({ embeds: [await this.Embeds.UnableToDeleteReactionRoleEmbed(interaction, Message)] }); } } } |