diff --git a/src/lib/bot.ts b/src/lib/bot.ts index 637b87a06..48d1b449d 100644 --- a/src/lib/bot.ts +++ b/src/lib/bot.ts @@ -1,5 +1,5 @@ +import { NDBModule } from "@/modules/core/NDB.module"; import { NestFactory } from "@nestjs/core"; -import { NDBModule } from "../modules/core/NDB.module"; async function bootstrap() { await NestFactory.createApplicationContext(NDBModule); diff --git a/src/lib/prisma-utils.ts b/src/lib/prisma-utils.ts index e5e7f6fc7..cd375e664 100644 --- a/src/lib/prisma-utils.ts +++ b/src/lib/prisma-utils.ts @@ -3,8 +3,8 @@ import { PrismaClientExceptionFilter } from "nestjs-prisma"; export const PrismaExceptionFilter = (httpAdapter) => { return new PrismaClientExceptionFilter(httpAdapter, { - P2000: HttpStatus.BAD_REQUEST, - P2002: HttpStatus.CONFLICT, - P2025: HttpStatus.NOT_FOUND, - }); + P2000: HttpStatus.BAD_REQUEST, + P2002: HttpStatus.CONFLICT, + P2025: HttpStatus.NOT_FOUND, + }); }; diff --git a/src/lib/top.gg-autoposter.ts b/src/lib/top.gg-autoposter.ts index 296a6f5fc..bce8771a4 100644 --- a/src/lib/top.gg-autoposter.ts +++ b/src/lib/top.gg-autoposter.ts @@ -22,7 +22,9 @@ export class TopGGAutoPoster extends DJSSharderPoster { this.logger.log("Started"); } this.on("posted", (stats) => { - this.logger.log(`Posted stats to Top.gg | ${stats.serverCount} Server(s) | ${stats.shardCount} Shard(s)`); + this.logger.log( + `Posted stats to Top.gg | ${stats.serverCount} Server(s) | ${stats.shardCount} Shard(s)`, + ); }).on("error", (error) => { this.logger.error(`Error when posting stats: ${error}`); }); diff --git a/src/modules/commands/Interaction.ts b/src/modules/commands/Interaction.ts index 0ffaf7e09..db1c69e12 100644 --- a/src/modules/commands/Interaction.ts +++ b/src/modules/commands/Interaction.ts @@ -1,6 +1,6 @@ -import { Content } from "@/types"; +import type { Content } from "@/types"; import { messageOptions } from "@/utils/Tools"; -import { +import type { BaseMessageOptions, CommandInteraction, EmbedBuilder, @@ -20,7 +20,9 @@ export class InteractionTools { }); } - public static async deferUpdate(interaction: MessageComponentInteraction): Promise { + public static async deferUpdate( + interaction: MessageComponentInteraction, + ): Promise { return await interaction.deferUpdate(); } diff --git a/src/modules/commands/Message.ts b/src/modules/commands/Message.ts index a069de2e5..f7304c766 100644 --- a/src/modules/commands/Message.ts +++ b/src/modules/commands/Message.ts @@ -1,7 +1,7 @@ -import { Content } from "@/types"; +import type { Content } from "@/types"; import { messageOptions } from "@/utils/Tools"; -import { +import type { EmojiResolvable, Message, MessageEditOptions, @@ -15,22 +15,34 @@ import { } from "discord.js"; export class MessageTools { - public static async send(target: User | PartialUser | TextBasedChannel, content: Content): Promise { + public static async send( + target: User | PartialUser | TextBasedChannel, + content: Content, + ): Promise { const msgOptions = messageOptions(content); return await target.send(msgOptions); } - public static async reply(message: Message, content: Content): Promise { + public static async reply( + message: Message, + content: Content, + ): Promise { const msgOptions = messageOptions(content); return await message.reply(msgOptions); } - public static async edit(message: Message, content: Content): Promise { + public static async edit( + message: Message, + content: Content, + ): Promise { const msgOptions = messageOptions(content) as MessageEditOptions; return await message.edit(msgOptions); } - public static async react(message: Message, emoji: EmojiResolvable): Promise { + public static async react( + message: Message, + emoji: EmojiResolvable, + ): Promise { return await message.react(emoji); } @@ -42,7 +54,10 @@ export class MessageTools { return await message.unpin(); } - public static async startThread(message: Message, options: StartThreadOptions): Promise { + public static async startThread( + message: Message, + options: StartThreadOptions, + ): Promise { return await message.startThread(options); } diff --git "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/DeveloperTools.decorator.ts" "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/DeveloperTools.decorator.ts" index 13259ca74..aa19b06a4 100644 --- "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/DeveloperTools.decorator.ts" +++ "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/DeveloperTools.decorator.ts" @@ -5,5 +5,7 @@ export const DeveloperToolsCommand = createCommandGroupDecorator({ name: "developer_tools", description: "Category 🛠️ Developer Tools", nameLocalizations: localizationMapByKey("DeveloperTools.category.name"), - descriptionLocalizations: localizationMapByKey("DeveloperTools.category.description"), + descriptionLocalizations: localizationMapByKey( + "DeveloperTools.category.description", + ), }); diff --git "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/Hello.command.ts" "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/Hello.command.ts" index d90428649..8ba83e5b2 100755 --- "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/Hello.command.ts" +++ "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/Hello.command.ts" @@ -1,13 +1,7 @@ import { CommandConfig, CommandPermissions } from "@/common/decorators/"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { CurrentTranslate, type TranslationFn } from "@necord/localization"; -import { Injectable, Logger, UseGuards } from "@nestjs/common"; -import { - Ctx, - SlashCommand, - type SlashCommandContext, - Subcommand, -} from "necord"; +import { Logger } from "@nestjs/common"; +import { Ctx, type SlashCommandContext, Subcommand } from "necord"; import { DeveloperToolsCommand } from "../DeveloperTools.decorator"; @DeveloperToolsCommand() diff --git "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.command.ts" "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.command.ts" index 88c6abb7c..9595f1cd6 100644 --- "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.command.ts" +++ "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.command.ts" @@ -1,13 +1,11 @@ import { inspect } from "node:util"; import { CommandConfig, CommandPermissions } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import type { Config } from "@/modules/config/types"; import { CurrentTranslate, type TranslationFn, localizationMapByKey, } from "@necord/localization"; -import { UseGuards } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import { EmbedBuilder, codeBlock } from "discord.js"; import { Ctx, Options, type SlashCommandContext, Subcommand } from "necord"; diff --git "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.dto.ts" "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.dto.ts" index 8f1e30fa2..60976aed3 100644 --- "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.dto.ts" +++ "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/eval/eval.dto.ts" @@ -5,8 +5,12 @@ export class EvalDTO { @StringOption({ name: "code", description: "Code to begin evaluated", - name_localizations: localizationMapByKey("DeveloperTools.eval.options.code.name"), - description_localizations: localizationMapByKey("DeveloperTools.eval.options.code.description"), + name_localizations: localizationMapByKey( + "DeveloperTools.eval.options.code.name", + ), + description_localizations: localizationMapByKey( + "DeveloperTools.eval.options.code.description", + ), required: true, autocomplete: false, }) diff --git "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/test.command.ts" "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/test.command.ts" index 026201457..e2ed46327 100644 --- "a/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/test.command.ts" +++ "b/src/modules/commands/\360\237\233\240\357\270\217 Developer Tools/commands/test.command.ts" @@ -1,11 +1,10 @@ import { CommandConfig, CommandPermissions } from "@/common/decorators/"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { CurrentTranslate, TranslationFn, localizationMapByKey, } from "@necord/localization"; -import { Logger, UseGuards } from "@nestjs/common"; +import { Logger } from "@nestjs/common"; import { Ctx, SlashCommandContext, Subcommand } from "necord"; import { DeveloperToolsCommand } from "../DeveloperTools.decorator"; diff --git "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/Moderation.decorator.ts" "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/Moderation.decorator.ts" index 7be120b16..76b10ae6a 100644 --- "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/Moderation.decorator.ts" +++ "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/Moderation.decorator.ts" @@ -5,5 +5,7 @@ export const ModerationCommand = createCommandGroupDecorator({ name: "moderation", description: "Category 🛡️ Moderation", nameLocalizations: localizationMapByKey("Moderation.category.name"), - descriptionLocalizations: localizationMapByKey("Moderation.category.description"), + descriptionLocalizations: localizationMapByKey( + "Moderation.category.description", + ), }); diff --git "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.command.ts" "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.command.ts" index 04dccae0f..fd34eac91 100644 --- "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.command.ts" +++ "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.command.ts" @@ -1,12 +1,11 @@ import { CommandConfig, CommandPermissions } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { WAIT } from "@/utils/Tools"; import { CurrentTranslate, TranslationFn, localizationMapByKey, } from "@necord/localization"; -import { Logger, UseGuards } from "@nestjs/common"; +import { Logger } from "@nestjs/common"; import { channelMention } from "discord.js"; import { Ctx, Options, SlashCommandContext, Subcommand } from "necord"; import { ModerationCommand } from "../../Moderation.decorator"; diff --git "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.dto.ts" "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.dto.ts" index 810c17911..0d2fd5bb5 100644 --- "a/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.dto.ts" +++ "b/src/modules/commands/\360\237\233\241\357\270\217 Moderation/commands/clear/clear.dto.ts" @@ -1,13 +1,17 @@ import { localizationMapByKey } from "@necord/localization"; -import { ChannelType, GuildTextBasedChannel } from "discord.js"; +import { ChannelType, type GuildTextBasedChannel } from "discord.js"; import { ChannelOption, NumberOption } from "necord"; export class ClearDTO { @NumberOption({ name: "amount", description: "Amount of messages that will be deletes (1-100)", - name_localizations: localizationMapByKey("Moderation.clear.options.amount.name"), - description_localizations: localizationMapByKey("Moderation.clear.options.amount.description"), + name_localizations: localizationMapByKey( + "Moderation.clear.options.amount.name", + ), + description_localizations: localizationMapByKey( + "Moderation.clear.options.amount.description", + ), min_value: 1, max_value: 100, autocomplete: false, @@ -18,8 +22,12 @@ export class ClearDTO { @ChannelOption({ name: "channel", description: "Channel where the messages will be deleted", - name_localizations: localizationMapByKey("Moderation.clear.options.channel.name"), - description_localizations: localizationMapByKey("Moderation.clear.options.channel.description"), + name_localizations: localizationMapByKey( + "Moderation.clear.options.channel.name", + ), + description_localizations: localizationMapByKey( + "Moderation.clear.options.channel.description", + ), channel_types: [ChannelType.GuildText], required: false, }) diff --git a/src/modules/config/JSONLocale.loader.ts b/src/modules/config/JSONLocale.loader.ts index e2c0b433d..f254cf67a 100644 --- a/src/modules/config/JSONLocale.loader.ts +++ b/src/modules/config/JSONLocale.loader.ts @@ -8,16 +8,22 @@ export class JSONLocaleLoader { public async loadTranslations() { const locales: Record> = {}; - const folders = fs.readdirSync(this.path).filter((f) => !this.ignoredFoldersAndFiles.includes(f)); + const folders = fs + .readdirSync(this.path) + .filter((f) => !this.ignoredFoldersAndFiles.includes(f)); for (const langFolder of folders) { const langPath = path.join(this.path, langFolder); - const namespaces = fs.readdirSync(langPath).filter((f) => !this.ignoredFoldersAndFiles.includes(f)); + const namespaces = fs + .readdirSync(langPath) + .filter((f) => !this.ignoredFoldersAndFiles.includes(f)); const langData = {}; for (const namespace of namespaces) { const namespacePath = path.join(langPath, namespace); - const files = fs.readdirSync(namespacePath).filter((f) => !this.ignoredFoldersAndFiles.includes(f)); + const files = fs + .readdirSync(namespacePath) + .filter((f) => !this.ignoredFoldersAndFiles.includes(f)); const namespaceData = {}; for (const file of files) { const filePath = path.join(namespacePath, file); diff --git a/src/modules/core/NDB.service.ts b/src/modules/core/NDB.service.ts index 2de1b1962..7d37ffc20 100644 --- a/src/modules/core/NDB.service.ts +++ b/src/modules/core/NDB.service.ts @@ -1,27 +1,49 @@ import type { Content } from "@/types"; -import { LOCALIZATION_ADAPTER, NestedLocalizationAdapter } from "@necord/localization"; -import { type ButtonsAppearance, NecordPaginationService, PageBuilder } from "@necord/pagination"; +import { + LOCALIZATION_ADAPTER, + NestedLocalizationAdapter, +} from "@necord/localization"; +import { + type ButtonsAppearance, + NecordPaginationService, + PageBuilder, +} from "@necord/pagination"; import { Inject, Injectable } from "@nestjs/common"; -import { ButtonStyle, type CommandInteraction, type EmbedBuilder } from "discord.js"; +import { + ButtonStyle, + type CommandInteraction, + type EmbedBuilder, +} from "discord.js"; import type { INDBService } from "./interfaces/INDBService"; @Injectable() export class NDBService implements INDBService { public constructor( - @Inject(LOCALIZATION_ADAPTER) private readonly translate: NestedLocalizationAdapter, + @Inject(LOCALIZATION_ADAPTER) + private readonly translate: NestedLocalizationAdapter, private readonly paginator: NecordPaginationService, ) {} - public async buildPaginator(interaction: CommandInteraction, embeds: EmbedBuilder[], id: string): Promise { + public async buildPaginator( + interaction: CommandInteraction, + embeds: EmbedBuilder[], + id: string, + ): Promise { const buttons: ButtonsAppearance = { back: { emoji: "⬅️", - label: this.translate.getTranslation("Tools.Paginator.Labels.Previous", interaction.guildLocale), + label: this.translate.getTranslation( + "Tools.Paginator.Labels.Previous", + interaction.guildLocale, + ), style: ButtonStyle.Secondary, }, next: { emoji: "➡️", - label: this.translate.getTranslation("Tools.Paginator.Labels.Next", interaction.guildLocale), + label: this.translate.getTranslation( + "Tools.Paginator.Labels.Next", + interaction.guildLocale, + ), style: ButtonStyle.Secondary, }, }; @@ -37,10 +59,14 @@ export class NDBService implements INDBService { Total: String(embeds.length), }, )}` - : this.translate.getTranslation("Tools.Paginator.Embed.Footer", interaction.guildLocale, { - Current: String(i + 1), - Total: String(embeds.length), - }), + : this.translate.getTranslation( + "Tools.Paginator.Embed.Footer", + interaction.guildLocale, + { + Current: String(i + 1), + Total: String(embeds.length), + }, + ), }); } @@ -50,7 +76,9 @@ export class NDBService implements INDBService { } return this.paginator - .register((builder) => builder.setCustomId(id).setPages(pages).setMaxPages(embeds.length)) + .register((builder) => + builder.setCustomId(id).setPages(pages).setMaxPages(embeds.length), + ) .setButtonsAppearance(buttons) .build(); } diff --git a/src/modules/core/interfaces/INDBService.ts b/src/modules/core/interfaces/INDBService.ts index ade44ec20..cdf3c633b 100644 --- a/src/modules/core/interfaces/INDBService.ts +++ b/src/modules/core/interfaces/INDBService.ts @@ -1,6 +1,10 @@ -import { Content } from "@/types"; +import type { Content } from "@/types"; import type { CommandInteraction, EmbedBuilder } from "discord.js"; export interface INDBService { - buildPaginator(interaction: CommandInteraction, embeds: EmbedBuilder[], id: string): Promise; + buildPaginator( + interaction: CommandInteraction, + embeds: EmbedBuilder[], + id: string, + ): Promise; } diff --git a/src/modules/core/provider/NDBService.provider.ts b/src/modules/core/provider/NDBService.provider.ts index 753b87983..fcb16ee40 100644 --- a/src/modules/core/provider/NDBService.provider.ts +++ b/src/modules/core/provider/NDBService.provider.ts @@ -1,8 +1,8 @@ import { Services } from "@/types/Constants"; -import { Provider } from "@nestjs/common"; +import type { Provider } from "@nestjs/common"; import { NDBService } from "../NDB.service"; -export const NDBServiceProvider: Provider = { +export const NDBServiceProvider: Provider = { provide: Services.NDB, useClass: NDBService, }; diff --git a/src/modules/database/database.service.ts b/src/modules/database/database.service.ts index fcee049b1..178d0e698 100644 --- a/src/modules/database/database.service.ts +++ b/src/modules/database/database.service.ts @@ -2,7 +2,10 @@ import type { IReactionRolesRepository } from "@/modules/reactionRoles/interface import { ReactionRoles } from "@/modules/reactionRoles/types/constants"; import { Inject, Injectable } from "@nestjs/common"; import type { IDatabaseService } from "./interfaces/IDatabaseService"; -import type { IGuildRepository, IUserRepository } from "./repositories/interfaces"; +import type { + IGuildRepository, + IUserRepository, +} from "./repositories/interfaces"; import { Repositories } from "./types/constants"; @Injectable() @@ -10,7 +13,8 @@ export class DatabaseService implements IDatabaseService { public constructor( @Inject(Repositories.Guild) private readonly guild: IGuildRepository, @Inject(Repositories.User) private readonly user: IUserRepository, - @Inject(ReactionRoles.Repository) private readonly reactionRoles: IReactionRolesRepository, + @Inject(ReactionRoles.Repository) + private readonly reactionRoles: IReactionRolesRepository, ) {} public GuildRepo(): IGuildRepository { diff --git a/src/modules/database/repositories/Guild.repository.ts b/src/modules/database/repositories/Guild.repository.ts index 632646fca..5a60e9925 100644 --- a/src/modules/database/repositories/Guild.repository.ts +++ b/src/modules/database/repositories/Guild.repository.ts @@ -1,9 +1,9 @@ import { Injectable, Logger } from "@nestjs/common"; -import { Prisma } from "@prisma/client"; -import { DefaultArgs } from "@prisma/client/runtime/library"; -import { Guild } from "discord.js"; +import type { Prisma } from "@prisma/client"; +import type { DefaultArgs } from "@prisma/client/runtime/library"; +import type { Guild } from "discord.js"; import { PrismaService } from "nestjs-prisma"; -import { GuildEntity } from "../entities"; +import type { GuildEntity } from "../entities"; import { DatabaseStatus } from "../types"; import type { IGuildRepository } from "./interfaces"; diff --git a/src/modules/database/repositories/interfaces/IGuildRepository.ts b/src/modules/database/repositories/interfaces/IGuildRepository.ts index 86652de96..730202b5c 100644 --- a/src/modules/database/repositories/interfaces/IGuildRepository.ts +++ b/src/modules/database/repositories/interfaces/IGuildRepository.ts @@ -1,14 +1,16 @@ +import type { Prisma } from "@prisma/client"; +import type { DefaultArgs } from "@prisma/client/runtime/library"; import type { Guild } from "discord.js"; import type { GuildEntity } from "../../entities"; import type { DatabaseStatus } from "../../types"; -import { Prisma } from "@prisma/client"; -import { DefaultArgs } from "@prisma/client/runtime/library"; export interface IGuildRepository { - guildSettings(): Prisma.GuildSettingsDelegate; + guildSettings(): Prisma.GuildSettingsDelegate; get(guildId: string): Promise; getAll(): Promise; - create(guild: Guild): Promise<{ callback: GuildEntity | void; status: DatabaseStatus }>; + create( + guild: Guild, + ): Promise<{ callback: GuildEntity | void; status: DatabaseStatus }>; update(oldGuild: Guild, newGuild: Guild): Promise; delete(guild: Guild): Promise; } diff --git a/src/modules/database/repositories/interfaces/IUserRepository.ts b/src/modules/database/repositories/interfaces/IUserRepository.ts index b421aaac7..98734eab5 100644 --- a/src/modules/database/repositories/interfaces/IUserRepository.ts +++ b/src/modules/database/repositories/interfaces/IUserRepository.ts @@ -1,14 +1,16 @@ +import type { Prisma } from "@prisma/client"; +import type { DefaultArgs } from "@prisma/client/runtime/library"; import type { User } from "discord.js"; import type { UserEntity } from "../../entities"; import type { DatabaseStatus } from "../../types"; -import { Prisma } from "@prisma/client"; -import { DefaultArgs } from "@prisma/client/runtime/library"; export interface IUserRepository { - userSettings(): Prisma.UserSettingsDelegate + userSettings(): Prisma.UserSettingsDelegate; get(userId: string): Promise; getAll(): Promise; - create(user: User): Promise<{ callback: UserEntity | void; status: DatabaseStatus }>; + create( + user: User, + ): Promise<{ callback: UserEntity | void; status: DatabaseStatus }>; update(user: User): Promise; delete(user: User): Promise; } diff --git a/src/modules/events/Events.module.ts b/src/modules/events/Events.module.ts index 58faa6305..d8459e81e 100644 --- a/src/modules/events/Events.module.ts +++ b/src/modules/events/Events.module.ts @@ -3,8 +3,8 @@ import { EventEmitter2, EventEmitterModule } from "@nestjs/event-emitter"; import { REST } from "discord.js"; import { GatewayEvents } from "./Gateway"; import { GuildEvents } from "./Guild"; -import { ThreadEvents } from "./Thread"; import { NDCEvents } from "./NDC"; +import { ThreadEvents } from "./Thread"; @Module({ imports: [ diff --git a/src/modules/events/Gateway.ts b/src/modules/events/Gateway.ts index 7946ccb1b..338aae4fc 100644 --- a/src/modules/events/Gateway.ts +++ b/src/modules/events/Gateway.ts @@ -55,7 +55,8 @@ export class GatewayEvents { @Once("debug") public async onDebug(@Context() [data]: ContextOf<"debug">) { - if (this.config.getOrThrow("Debug").Client) this.logger.debug(data); + if (this.config.getOrThrow("Debug").Client) + this.logger.debug(data); } @On("error") @@ -72,9 +73,14 @@ export class GatewayEvents { @OnEvent("rest") public async onRest(rest: REST) { - rest.on("rateLimited", async ({ majorParameter, timeToReset, route, method }: RateLimitData) => { - this.logger.fatal(`RateLimit on route: ${method} ${route} ${majorParameter}, Time: ${timeToReset}ms`); - }); + rest.on( + "rateLimited", + async ({ majorParameter, timeToReset, route, method }: RateLimitData) => { + this.logger.fatal( + `RateLimit on route: ${method} ${route} ${majorParameter}, Time: ${timeToReset}ms`, + ); + }, + ); } private async _setPresence(client: Client) { @@ -105,7 +111,10 @@ export class GatewayEvents { }; function setPresence() { - const activity = presences.activities[Math.floor(Math.random() * presences.activities.length)]; + const activity = + presences.activities[ + Math.floor(Math.random() * presences.activities.length) + ]; client.user.setPresence({ activities: [activity], }); diff --git a/src/modules/events/Guild.ts b/src/modules/events/Guild.ts index 2a9d2db7e..9c201602f 100644 --- a/src/modules/events/Guild.ts +++ b/src/modules/events/Guild.ts @@ -22,12 +22,16 @@ export class GuildEvents { } @On("guildUpdate") - public async onGuildUpdate(@Context() [oldGuild, newGuild]: ContextOf<"guildUpdate">) { + public async onGuildUpdate( + @Context() [oldGuild, newGuild]: ContextOf<"guildUpdate">, + ) { await this.database.GuildRepo().update(oldGuild, newGuild); } @On("guildMemberRemove") - public async onGuildMemberRemove(@Context() [member]: ContextOf<"guildMemberRemove">) { + public async onGuildMemberRemove( + @Context() [member]: ContextOf<"guildMemberRemove">, + ) { if (member.id === this.client.user.id) { await this.database.GuildRepo().delete(member.guild); } diff --git a/src/modules/events/NDC.ts b/src/modules/events/NDC.ts index bfbca2e41..4da1513ad 100644 --- a/src/modules/events/NDC.ts +++ b/src/modules/events/NDC.ts @@ -25,11 +25,15 @@ export class NDCEvents { } @On("voiceChannelJoin") - public onVoiceChannelJoin(@Context() [member, channel]: ContextOf<"voiceChannelJoin">) { + public onVoiceChannelJoin( + @Context() [member, channel]: ContextOf<"voiceChannelJoin">, + ) { if (!this.checkGuild(channel.guildId)) return; - if(this.ids.includes(channel.id)) { - member.voice.disconnect(`User entered in Placeholder channel: ${channel.name}`); - } + if (this.ids.includes(channel.id)) { + member.voice.disconnect( + `User entered in Placeholder channel: ${channel.name}`, + ); + } } private checkGuild(guildId: string): boolean { diff --git a/src/modules/events/NotQuiteNitro.ts b/src/modules/events/NotQuiteNitro.ts index 364d96471..acf091d99 100644 --- a/src/modules/events/NotQuiteNitro.ts +++ b/src/modules/events/NotQuiteNitro.ts @@ -1,4 +1,7 @@ -import { LOCALIZATION_ADAPTER, NestedLocalizationAdapter } from "@necord/localization"; +import { + LOCALIZATION_ADAPTER, + NestedLocalizationAdapter, +} from "@necord/localization"; import { Inject, Injectable } from "@nestjs/common"; import { OnEvent } from "@nestjs/event-emitter"; import { Client, Message, TextChannel } from "discord.js"; @@ -6,7 +9,8 @@ import { Client, Message, TextChannel } from "discord.js"; @Injectable() export class NotQuiteNitroEvent { public constructor( - @Inject(LOCALIZATION_ADAPTER) private readonly translate: NestedLocalizationAdapter, + @Inject(LOCALIZATION_ADAPTER) + private readonly translate: NestedLocalizationAdapter, private readonly client: Client, ) {} @@ -17,12 +21,20 @@ export class NotQuiteNitroEvent { const emoji = this.client.emojis.cache.find((e) => e.name === _emoji); if (!emoji) return; if (new RegExp(emoji.toString(), "g").test(replyContent)) { - replyContent = message.content.replace(new RegExp(emoji.toString(), "g"), emoji.toString()); + replyContent = message.content.replace( + new RegExp(emoji.toString(), "g"), + emoji.toString(), + ); } else { - replyContent = message.content.replace(new RegExp(`:${_emoji}:`, "g"), emoji.toString()); + replyContent = message.content.replace( + new RegExp(`:${_emoji}:`, "g"), + emoji.toString(), + ); } - const webhook = (await (message.channel as TextChannel).fetchWebhooks()).find((w) => w.name === "N-D-B_NQN"); + const webhook = ( + await (message.channel as TextChannel).fetchWebhooks() + ).find((w) => w.name === "N-D-B_NQN"); if (!webhook) { await (message.channel as TextChannel).createWebhook({ reason: this.translate.getTranslation( @@ -38,7 +50,9 @@ export class NotQuiteNitroEvent { }); } await webhook.edit({ - name: message.member.nickname ? message.member.nickname : message.author.username, + name: message.member.nickname + ? message.member.nickname + : message.author.username, avatar: message.author.displayAvatarURL(), }); diff --git a/src/modules/events/Thread.ts b/src/modules/events/Thread.ts index 697682d42..73d5c3c23 100644 --- a/src/modules/events/Thread.ts +++ b/src/modules/events/Thread.ts @@ -4,7 +4,9 @@ import { Context, ContextOf, On } from "necord"; @Injectable() export class ThreadEvents { @On("threadCreate") - public async onThreadCreate(@Context() [thread, newlyCreated]: ContextOf<"threadCreate">) { + public async onThreadCreate( + @Context() [thread, newlyCreated]: ContextOf<"threadCreate">, + ) { if (thread.joinable && newlyCreated) { await thread.join(); } diff --git a/src/modules/reactionRoles/ReactionRoles.decorator.ts b/src/modules/reactionRoles/ReactionRoles.decorator.ts index 3115e51af..71df89034 100644 --- a/src/modules/reactionRoles/ReactionRoles.decorator.ts +++ b/src/modules/reactionRoles/ReactionRoles.decorator.ts @@ -5,6 +5,8 @@ export const ReactionRolesCommand = createCommandGroupDecorator({ name: "reaction_roles", description: "Category 🎩 ReactionRoles", nameLocalizations: localizationMapByKey("ReactionRoles.category.name"), - descriptionLocalizations: localizationMapByKey("ReactionRoles.category.description"), + descriptionLocalizations: localizationMapByKey( + "ReactionRoles.category.description", + ), dmPermission: false, }); diff --git a/src/modules/reactionRoles/ReactionRoles.embeds.ts b/src/modules/reactionRoles/ReactionRoles.embeds.ts index acf82d441..ffb44ffe8 100644 --- a/src/modules/reactionRoles/ReactionRoles.embeds.ts +++ b/src/modules/reactionRoles/ReactionRoles.embeds.ts @@ -1,6 +1,9 @@ import { MessageTools } from "@/modules/commands/Message"; import type { Config } from "@/modules/config/types"; -import { LOCALIZATION_ADAPTER, NestedLocalizationAdapter } from "@necord/localization"; +import { + LOCALIZATION_ADAPTER, + NestedLocalizationAdapter, +} from "@necord/localization"; import { Inject, Injectable } from "@nestjs/common"; import { ConfigService } from "@nestjs/config"; import { @@ -17,11 +20,14 @@ import type { IReaction, REACTION_OPTIONS } from "./types"; @Injectable() export class ReactionRolesEmbeds implements IReactionRolesEmbeds { public constructor( - @Inject(LOCALIZATION_ADAPTER) private readonly translate: NestedLocalizationAdapter, + @Inject(LOCALIZATION_ADAPTER) + private readonly translate: NestedLocalizationAdapter, private readonly config: ConfigService, ) {} - public async InvalidChannelEmbed(interaction: CommandInteraction): Promise { + public async InvalidChannelEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.id, @@ -29,13 +35,19 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.Channel.Invalid", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.Channel.Invalid", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } - public async InvalidIDEmbed(interaction: CommandInteraction): Promise { + public async InvalidIDEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.id, @@ -43,13 +55,19 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.ID.Invalid", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.ID.Invalid", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } - public async MessageNotFoundEmbed(interaction: CommandInteraction): Promise { + public async MessageNotFoundEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.id, @@ -57,13 +75,19 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.ID.NotFound", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.ID.NotFound", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } - public async InvalidRoleEmbed(interaction: CommandInteraction): Promise { + public async InvalidRoleEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.id, @@ -71,13 +95,19 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.Role.Invalid", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.Role.Invalid", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } - public async InvalidEmojiEmbed(interaction: CommandInteraction): Promise { + public async InvalidEmojiEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.id, @@ -85,9 +115,13 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.Emoji.Invalid", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.Emoji.Invalid", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } @@ -97,46 +131,72 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { ): Promise { return new EmbedBuilder() .setAuthor({ - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Author", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Author", + interaction.guildLocale, + ), iconURL: interaction.guild.iconURL(), }) .setColor("#00c26f") .addFields([ { - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Fields.1", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Fields.1", + interaction.guildLocale, + ), value: channelMention(Channel), inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Fields.2", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Fields.2", + interaction.guildLocale, + ), value: Emoji, inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Fields.3", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Fields.3", + interaction.guildLocale, + ), value: String(Option), inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Fields.4", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Fields.4", + interaction.guildLocale, + ), value: this.translate.getTranslation( "ReactionRoles.CreateReaction.Embed.Fields.Content.4", interaction.guildLocale, { MsgIdURL: ( - await MessageTools.get((await interaction.guild.channels.fetch(Channel)) as TextChannel, Message) + await MessageTools.get( + (await interaction.guild.channels.fetch( + Channel, + )) as TextChannel, + Message, + ) ).url, }, ), }, { - name: this.translate.getTranslation("ReactionRoles.CreateReaction.Embed.Fields.5", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.CreateReaction.Embed.Fields.5", + interaction.guildLocale, + ), value: roleMention(Role), }, ]); } - public async ReactionRoleRemovedEmbed(interaction: CommandInteraction, MsgID: Message): Promise { + public async ReactionRoleRemovedEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.tag, @@ -144,10 +204,14 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#00c26f") .setDescription( - this.translate.getTranslation("ReactionRoles.DeleteReaction.Removed", interaction.guildLocale, { - success: this.config.get("Emojis").accept, - URL: MsgID.url, - }), + this.translate.getTranslation( + "ReactionRoles.DeleteReaction.Removed", + interaction.guildLocale, + { + success: this.config.get("Emojis").accept, + URL: MsgID.url, + }, + ), ); } @@ -163,46 +227,71 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#00c26f") .setDescription( - this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Description", interaction.guildLocale), + this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Description", + interaction.guildLocale, + ), ) .addFields( { - name: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Fields.1", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Fields.1", + interaction.guildLocale, + ), value: channelMention(Channel), inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Fields.2", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Fields.2", + interaction.guildLocale, + ), value: Emoji, inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Fields.3", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Fields.3", + interaction.guildLocale, + ), value: this.translate.getTranslation( "ReactionRoles.UpdateReaction.Embed.Fields.Content.3", interaction.guildLocale, { MsgIdURL: ( - await ((await interaction.guild.channels.fetch(Channel)) as TextChannel).messages.fetch(Message) + await ( + (await interaction.guild.channels.fetch( + Channel, + )) as TextChannel + ).messages.fetch(Message) ).url, }, ), inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Fields.4", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Fields.4", + interaction.guildLocale, + ), value: roleMention(Role), inline: true, }, { - name: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Fields.5", interaction.guildLocale), + name: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Fields.5", + interaction.guildLocale, + ), value: newOption.toString(), inline: true, }, ) .setFooter({ - text: this.translate.getTranslation("ReactionRoles.UpdateReaction.Embed.Footer", interaction.guildLocale), + text: this.translate.getTranslation( + "ReactionRoles.UpdateReaction.Embed.Footer", + interaction.guildLocale, + ), }); } @@ -215,20 +304,28 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { let color: number; switch (status) { case "Confirm": - description = "ReactionRoles.DeleteAllReactions.Embed.Description.Confirm"; + description = + "ReactionRoles.DeleteAllReactions.Embed.Description.Confirm"; color = 0x00c26f; break; case "Cancel": - description = "ReactionRoles.DeleteAllReactions.Embed.Description.Cancel"; + description = + "ReactionRoles.DeleteAllReactions.Embed.Description.Cancel"; color = 0xc20e00; break; case "Success": - description = "ReactionRoles.DeleteAllReactions.Embed.Description.Success"; + description = + "ReactionRoles.DeleteAllReactions.Embed.Description.Success"; color = 0x00c26f; break; } return new EmbedBuilder() - .setTitle(this.translate.getTranslation("ReactionRoles.DeleteAllReactions.Embed.Title", interaction.guildLocale)) + .setTitle( + this.translate.getTranslation( + "ReactionRoles.DeleteAllReactions.Embed.Title", + interaction.guildLocale, + ), + ) .setAuthor({ name: interaction.user.username, iconURL: interaction.user.displayAvatarURL(), @@ -241,7 +338,9 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { .setColor(color); } - public async UnableToCreateReactionRoleEmbed(interaction: CommandInteraction): Promise { + public async UnableToCreateReactionRoleEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.tag, @@ -249,13 +348,20 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.CreateReaction.UnableToCreate", interaction.guildLocale, { - fail: this.config.get("Emojis").fail, - }), + this.translate.getTranslation( + "ReactionRoles.CreateReaction.UnableToCreate", + interaction.guildLocale, + { + fail: this.config.get("Emojis").fail, + }, + ), ); } - public async UnableToDeleteReactionRoleEmbed(interaction: CommandInteraction, MsgID: Message): Promise { + public async UnableToDeleteReactionRoleEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.tag, @@ -263,14 +369,20 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.DeleteReaction.UnableToDelete", interaction.guildLocale, { - success: this.config.get("Emojis").accept, - URL: MsgID.url, - }), + this.translate.getTranslation( + "ReactionRoles.DeleteReaction.UnableToDelete", + interaction.guildLocale, + { + success: this.config.get("Emojis").accept, + URL: MsgID.url, + }, + ), ); } - public async UnableToDeleteAllReactionRoleEmbed(interaction: CommandInteraction): Promise { + public async UnableToDeleteAllReactionRoleEmbed( + interaction: CommandInteraction, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.tag, @@ -278,11 +390,17 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.DeleteAllReaction.UnableToDelete", interaction.guildLocale), + this.translate.getTranslation( + "ReactionRoles.DeleteAllReaction.UnableToDelete", + interaction.guildLocale, + ), ); } - public async UnableToUpdateReactionRoleEmbed(interaction: CommandInteraction, MsgID: Message): Promise { + public async UnableToUpdateReactionRoleEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise { return new EmbedBuilder() .setAuthor({ name: interaction.user.tag, @@ -290,10 +408,14 @@ export class ReactionRolesEmbeds implements IReactionRolesEmbeds { }) .setColor("#c20e00") .setDescription( - this.translate.getTranslation("ReactionRoles.UpdateReaction.UnableToUpdate", interaction.guildLocale, { - success: this.config.get("Emojis").accept, - URL: MsgID.url, - }), + this.translate.getTranslation( + "ReactionRoles.UpdateReaction.UnableToUpdate", + interaction.guildLocale, + { + success: this.config.get("Emojis").accept, + URL: MsgID.url, + }, + ), ); } } diff --git a/src/modules/reactionRoles/ReactionRoles.module.ts b/src/modules/reactionRoles/ReactionRoles.module.ts index 0717f35be..a68476cdd 100644 --- a/src/modules/reactionRoles/ReactionRoles.module.ts +++ b/src/modules/reactionRoles/ReactionRoles.module.ts @@ -1,10 +1,18 @@ import { Global, Module } from "@nestjs/common"; import * as Commands from "./commands"; import { ReactionRolesEvents } from "./events/ReactionRoles"; -import { ReactionRolesEmbedsProvider, ReactionRolesProvider } from "./types/providers"; +import { + ReactionRolesEmbedsProvider, + ReactionRolesProvider, +} from "./types/providers"; @Global() @Module({ - providers: [ReactionRolesEvents, ReactionRolesProvider, ReactionRolesEmbedsProvider, ...Object.values(Commands)], + providers: [ + ReactionRolesEvents, + ReactionRolesProvider, + ReactionRolesEmbedsProvider, + ...Object.values(Commands), + ], exports: [ReactionRolesProvider, ReactionRolesEmbedsProvider], }) export class ReactionRolesModule {} diff --git a/src/modules/reactionRoles/ReactionRoles.repository.ts b/src/modules/reactionRoles/ReactionRoles.repository.ts index 9e2faea35..e844c1535 100644 --- a/src/modules/reactionRoles/ReactionRoles.repository.ts +++ b/src/modules/reactionRoles/ReactionRoles.repository.ts @@ -29,12 +29,18 @@ export class ReactionRolesRepository implements IReactionRolesRepository { })[0]; } - public async getInChannel(guild: Guild, channel: TextChannel): Promise { + public async getInChannel( + guild: Guild, + channel: TextChannel, + ): Promise { const data = await this.getAll(guild); return data.filter(async (reaction) => reaction.Channel === channel.id); } - private async checkIfExists(guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction): Promise { + private async checkIfExists( + guild: Guild, + { Channel, Message, Role, Emoji, Option }: IReaction, + ): Promise { const GetGuild = await this.getAll(guild); let Verify = false; for (const reaction of GetGuild) { @@ -117,7 +123,9 @@ export class ReactionRolesRepository implements IReactionRolesRepository { return { status: "Deleted" }; } - public async deleteMany(guild: Guild): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }> { + public async deleteMany( + guild: Guild, + ): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }> { const count = await this.prisma.guildReactionRoles.count({ where: { guildId: guild.id }, }); diff --git a/src/modules/reactionRoles/ReactionRoles.service.ts b/src/modules/reactionRoles/ReactionRoles.service.ts index c3bee2d53..d1c7b9c66 100644 --- a/src/modules/reactionRoles/ReactionRoles.service.ts +++ b/src/modules/reactionRoles/ReactionRoles.service.ts @@ -2,12 +2,12 @@ import type { IDatabaseService } from "@/modules/database/interfaces/IDatabaseSe import { Services } from "@/types/Constants"; import { Inject, Injectable } from "@nestjs/common"; import type { - Client, - CommandInteraction, - Guild, - Message, - Role, - TextChannel, + Client, + CommandInteraction, + Guild, + Message, + Role, + TextChannel, } from "discord.js"; import type { ReactionRolesEntity } from "./entities/ReactionRole.entity"; import type { IReactionRolesEmbeds, IReactionRolesService } from "./interfaces"; diff --git a/src/modules/reactionRoles/commands/CreateReaction/CreateReaction.dto.ts b/src/modules/reactionRoles/commands/CreateReaction/CreateReaction.dto.ts index 51cef659d..964dfff91 100644 --- a/src/modules/reactionRoles/commands/CreateReaction/CreateReaction.dto.ts +++ b/src/modules/reactionRoles/commands/CreateReaction/CreateReaction.dto.ts @@ -6,8 +6,12 @@ export class CreateReactionDTO { @ChannelOption({ name: "channel", description: "Channel where the ReactionRole will be created", - name_localizations: localizationMapByKey("ReactionRoles.create.options.channel.name"), - description_localizations: localizationMapByKey("ReactionRoles.create.options.channel.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.create.options.channel.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.create.options.channel.description", + ), channel_types: [ChannelType.GuildText], required: true, }) @@ -16,8 +20,12 @@ export class CreateReactionDTO { @StringOption({ name: "message", description: "Message ID that the member will react", - name_localizations: localizationMapByKey("ReactionRoles.create.options.message.name"), - description_localizations: localizationMapByKey("ReactionRoles.create.options.message.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.create.options.message.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.create.options.message.description", + ), required: true, }) public readonly messageId: string; @@ -25,8 +33,12 @@ export class CreateReactionDTO { @RoleOption({ name: "role", description: "Role to be used in ReactionRole", - name_localizations: localizationMapByKey("ReactionRoles.create.options.role.name"), - description_localizations: localizationMapByKey("ReactionRoles.create.options.role.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.create.options.role.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.create.options.role.description", + ), required: true, }) public readonly role: Role; @@ -34,8 +46,12 @@ export class CreateReactionDTO { @StringOption({ name: "emoji", description: "Emoji that the user will react", - name_localizations: localizationMapByKey("ReactionRoles.create.options.emoji.name"), - description_localizations: localizationMapByKey("ReactionRoles.create.options.emoji.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.create.options.emoji.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.create.options.emoji.description", + ), required: true, }) public readonly emoji: string; @@ -43,8 +59,12 @@ export class CreateReactionDTO { @NumberOption({ name: "type", description: "Type of ReactionRole (1-6) (/reaction_role types)", - name_localizations: localizationMapByKey("ReactionRoles.create.options.type.name"), - description_localizations: localizationMapByKey("ReactionRoles.create.options.type.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.create.options.type.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.create.options.type.description", + ), required: false, }) public readonly option: number; diff --git a/src/modules/reactionRoles/commands/DeleteAllReactions.command.ts b/src/modules/reactionRoles/commands/DeleteAllReactions.command.ts index 7442c60bf..7d000ab07 100644 --- a/src/modules/reactionRoles/commands/DeleteAllReactions.command.ts +++ b/src/modules/reactionRoles/commands/DeleteAllReactions.command.ts @@ -1,12 +1,11 @@ import { CommandConfig, CommandPermissions } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { Buttons, ConfirmButtonEnum, } from "@/modules/components/Buttons.component"; import { Extends } from "@/types/Constants"; import { localizationMapByKey } from "@necord/localization"; -import { Inject, Logger, UseGuards } from "@nestjs/common"; +import { Inject, Logger } from "@nestjs/common"; import { CommandInteraction } from "discord.js"; import { Button, diff --git a/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.command.ts b/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.command.ts index a639780a9..d28bb4f6e 100644 --- a/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.command.ts +++ b/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.command.ts @@ -3,11 +3,10 @@ import { CommandPermissions, ValidatedOptions, } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { Buttons } from "@/modules/components/Buttons.component"; import { Extends } from "@/types/Constants"; import { localizationMapByKey } from "@necord/localization"; -import { Inject, Logger, UseGuards } from "@nestjs/common"; +import { Inject, Logger } from "@nestjs/common"; import { Client, TextChannel } from "discord.js"; import { Ctx, SlashCommandContext, Subcommand } from "necord"; import { ReactionRolesCommand } from "../../ReactionRoles.decorator"; diff --git a/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.dto.ts b/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.dto.ts index 2d34e9e3e..e191ebf61 100644 --- a/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.dto.ts +++ b/src/modules/reactionRoles/commands/DeleteReaction/DeleteReaction.dto.ts @@ -6,8 +6,12 @@ export class DeleteReactionDTO { @ChannelOption({ name: "channel", description: "Channel where the ReactionRole will be created", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.channel.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.channel.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.channel.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.channel.description", + ), channel_types: [ChannelType.GuildText], required: true, }) @@ -16,8 +20,12 @@ export class DeleteReactionDTO { @StringOption({ name: "message", description: "Message ID that the member will react", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.message.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.message.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.message.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.message.description", + ), required: true, }) public readonly messageId: string; @@ -25,8 +33,12 @@ export class DeleteReactionDTO { @RoleOption({ name: "role", description: "Role to be used in ReactionRole", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.role.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.role.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.role.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.role.description", + ), required: true, }) public readonly role: Role; @@ -34,8 +46,12 @@ export class DeleteReactionDTO { @StringOption({ name: "emoji", description: "Emoji that the user will react", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.emoji.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.emoji.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.emoji.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.emoji.description", + ), required: true, }) public readonly emoji: string; diff --git a/src/modules/reactionRoles/commands/EditReaction/EditReaction.command.ts b/src/modules/reactionRoles/commands/EditReaction/EditReaction.command.ts index 255c4f5af..c19bc01cd 100644 --- a/src/modules/reactionRoles/commands/EditReaction/EditReaction.command.ts +++ b/src/modules/reactionRoles/commands/EditReaction/EditReaction.command.ts @@ -3,10 +3,9 @@ import { CommandPermissions, ValidatedOptions, } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { Buttons } from "@/modules/components/Buttons.component"; import { Extends } from "@/types/Constants"; -import { Inject, Logger, UseGuards } from "@nestjs/common"; +import { Inject, Logger } from "@nestjs/common"; import { Client, TextChannel } from "discord.js"; import { Ctx, SlashCommandContext, Subcommand } from "necord"; import { ReactionRolesCommand } from "../../ReactionRoles.decorator"; diff --git a/src/modules/reactionRoles/commands/EditReaction/EditReaction.dto.ts b/src/modules/reactionRoles/commands/EditReaction/EditReaction.dto.ts index 42addc70b..2b1e51b68 100644 --- a/src/modules/reactionRoles/commands/EditReaction/EditReaction.dto.ts +++ b/src/modules/reactionRoles/commands/EditReaction/EditReaction.dto.ts @@ -6,8 +6,12 @@ export class EditReactionDTO { @ChannelOption({ name: "channel", description: "Channel where the ReactionRole will be created", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.channel.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.channel.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.channel.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.channel.description", + ), channel_types: [ChannelType.GuildText], required: true, }) @@ -16,8 +20,12 @@ export class EditReactionDTO { @StringOption({ name: "message", description: "Message ID that the member will react", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.message.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.message.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.message.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.message.description", + ), required: true, }) public readonly messageId: string; @@ -25,8 +33,12 @@ export class EditReactionDTO { @RoleOption({ name: "role", description: "Role to be used in ReactionRole", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.role.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.role.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.role.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.role.description", + ), required: true, }) public readonly role: Role; @@ -34,8 +46,12 @@ export class EditReactionDTO { @StringOption({ name: "emoji", description: "Emoji that the user will react", - name_localizations: localizationMapByKey("ReactionRoles.delete.options.emoji.name"), - description_localizations: localizationMapByKey("ReactionRoles.delete.options.emoji.description"), + name_localizations: localizationMapByKey( + "ReactionRoles.delete.options.emoji.name", + ), + description_localizations: localizationMapByKey( + "ReactionRoles.delete.options.emoji.description", + ), required: true, }) public readonly emoji: string; diff --git a/src/modules/reactionRoles/commands/ReactionTypes.command.ts b/src/modules/reactionRoles/commands/ReactionTypes.command.ts index 0875e87b8..fe3b19730 100644 --- a/src/modules/reactionRoles/commands/ReactionTypes.command.ts +++ b/src/modules/reactionRoles/commands/ReactionTypes.command.ts @@ -1,7 +1,6 @@ import { CommandConfig, CommandPermissions } from "@/common/decorators"; -import { CommandConfigGuard, CommandPermissionsGuard } from "@/common/guards"; import { localizationMapByKey } from "@necord/localization"; -import { Inject, Logger, UseGuards } from "@nestjs/common"; +import { Inject, Logger } from "@nestjs/common"; import { Ctx, SlashCommandContext, Subcommand } from "necord"; import { ReactionRolesCommand } from "../ReactionRoles.decorator"; import type { diff --git a/src/modules/reactionRoles/events/ReactionRoles.ts b/src/modules/reactionRoles/events/ReactionRoles.ts index 0acbdde84..f8609401c 100644 --- a/src/modules/reactionRoles/events/ReactionRoles.ts +++ b/src/modules/reactionRoles/events/ReactionRoles.ts @@ -1,7 +1,10 @@ import { MessageTools } from "@/modules/commands/Message"; import type { IDatabaseService } from "@/modules/database/interfaces/IDatabaseService"; import { Services } from "@/types/Constants"; -import { LOCALIZATION_ADAPTER, NestedLocalizationAdapter } from "@necord/localization"; +import { + LOCALIZATION_ADAPTER, + NestedLocalizationAdapter, +} from "@necord/localization"; import { Inject, Injectable } from "@nestjs/common"; import { Client, EmbedBuilder, roleMention } from "discord.js"; import { Context, type ContextOf, On } from "necord"; @@ -12,28 +15,37 @@ import { ReactionRoles } from "../types/constants"; export class ReactionRolesEvents { public constructor( @Inject(Services.Database) private readonly database: IDatabaseService, - @Inject(ReactionRoles.Service) private readonly reactionRoles: IReactionRolesService, - @Inject(LOCALIZATION_ADAPTER) private readonly translate: NestedLocalizationAdapter, + @Inject(ReactionRoles.Service) + private readonly reactionRoles: IReactionRolesService, + @Inject(LOCALIZATION_ADAPTER) + private readonly translate: NestedLocalizationAdapter, private readonly client: Client, ) {} @On("messageReactionAdd") - public async onReactionRolesAdd(@Context() [reaction, user]: ContextOf<"messageReactionAdd">) { + public async onReactionRolesAdd( + @Context() [reaction, user]: ContextOf<"messageReactionAdd">, + ) { if (user === this.client.user) return; const TIMER: number = 10 * 1000; const ReactionCooldown = new Set(); const ClientCooldown = new Set(); const data = await this.reactionRoles.getAll(reaction.message.guild); - const GuildData = await this.database.GuildRepo().get(reaction.message.guildId); + const GuildData = await this.database + .GuildRepo() + .get(reaction.message.guildId); const Guild = reaction.message.guild; const Member = Guild.members.cache.get(user.id); if (!data) return; for (const Data of data) { - const SplitEmoji = Data.Emoji.replace(/<:|>/g, "") + const SplitEmoji = Data.Emoji.replace(/<:|>/g, ""); - if (reaction.emoji.identifier === SplitEmoji && reaction.message.id === Data.Message) { + if ( + reaction.emoji.identifier === SplitEmoji && + reaction.message.id === Data.Message + ) { const Role = Guild.roles.cache.get(Data.Role); const Message = Data.Message; const Channel = Data.Channel; @@ -226,7 +238,11 @@ export class ReactionRolesEvents { if (Option === 1) { try { - if (!Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + !Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .add( Role, @@ -260,7 +276,11 @@ export class ReactionRolesEvents { if (Option === 2) { try { - if (!Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + !Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .add( Role, @@ -290,7 +310,11 @@ export class ReactionRolesEvents { if (Option === 3) { try { - if (Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .remove( Role, @@ -301,7 +325,9 @@ export class ReactionRolesEvents { ) .catch(() => {}); if (GuildData.Settings.ReactionDM) { - MessageTools.send(user, { embeds: [RemoveEmbed] }).catch(() => {}); + MessageTools.send(user, { embeds: [RemoveEmbed] }).catch( + () => {}, + ); } ReactionCooldown.add(user.id); setTimeout(() => { @@ -320,7 +346,11 @@ export class ReactionRolesEvents { if (Option === 4) { try { - if (Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .remove( Role, @@ -332,7 +362,9 @@ export class ReactionRolesEvents { .catch(() => {}); ReactionCooldown.add(user.id); if (GuildData.Settings.ReactionDM) { - MessageTools.send(user, { embeds: [RemoveEmbed] }).catch(() => {}); + MessageTools.send(user, { embeds: [RemoveEmbed] }).catch( + () => {}, + ); } setTimeout(() => { ReactionCooldown.delete(user.id); @@ -350,7 +382,11 @@ export class ReactionRolesEvents { if (Option === 5) { try { - if (Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles.remove( Role, this.translate.getTranslation( @@ -364,7 +400,9 @@ export class ReactionRolesEvents { .catch(() => {}); if (GuildData.Settings.ReactionDM) { - MessageTools.send(user, { embeds: [RemoveEmbed] }).catch(() => {}); + MessageTools.send(user, { embeds: [RemoveEmbed] }).catch( + () => {}, + ); } ReactionCooldown.add(user.id); setTimeout(() => { @@ -383,7 +421,11 @@ export class ReactionRolesEvents { if (Option === 6) { try { - if (Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { reaction.message.reactions.cache .find((r) => r.emoji.name === Emoji.name) .users.remove(user.id) @@ -405,7 +447,11 @@ export class ReactionRolesEvents { return; } - if (!Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + !Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { reaction.message.reactions.cache .find((r) => r.emoji.name === Emoji.name) .users.remove(user.id) @@ -442,14 +488,18 @@ export class ReactionRolesEvents { } @On("messageReactionRemove") - public async onReactionRolesRemove(@Context() [reaction, user]: ContextOf<"messageReactionAdd">) { + public async onReactionRolesRemove( + @Context() [reaction, user]: ContextOf<"messageReactionAdd">, + ) { if (user === this.client.user) return; const TIMER: number = 10 * 1000; const ReactionCooldown = new Set(); const ClientCooldown = new Set(); const data = await this.reactionRoles.getAll(reaction.message.guild); - const GuildData = await this.database.GuildRepo().get(reaction.message.guildId); + const GuildData = await this.database + .GuildRepo() + .get(reaction.message.guildId); const Member = reaction.message.guild.members.cache.get(user.id); const Guild = reaction.message.guild; if (!data) return; @@ -457,7 +507,10 @@ export class ReactionRolesEvents { for (const Data of data) { const SplitEmoji = Data.Emoji.replace(/<:|>/g, ""); - if (reaction.emoji.identifier === SplitEmoji && reaction.message.id === Data.Message) { + if ( + reaction.emoji.identifier === SplitEmoji && + reaction.message.id === Data.Message + ) { const Role = Guild.roles.cache.get(Data.Role); const Message = Data.Message; const Channel = Data.Channel; @@ -650,7 +703,11 @@ export class ReactionRolesEvents { if (Option === 1) { try { - if (Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .remove( Role, @@ -667,7 +724,9 @@ export class ReactionRolesEvents { if (GuildData.Settings.ReactionDM) { if (ClientCooldown.has(reaction.message.guildId)) return; - MessageTools.send(user, { embeds: [RemoveEmbed] }).catch(() => {}); + MessageTools.send(user, { embeds: [RemoveEmbed] }).catch( + () => {}, + ); ClientCooldown.add(reaction.message.guildId); setTimeout(() => { ClientCooldown.delete(reaction.message.guildId); @@ -686,7 +745,11 @@ export class ReactionRolesEvents { if (Option === 4) { try { - if (!Member.roles.cache.find((r) => r.name.toLowerCase() === Role.name.toLowerCase())) { + if ( + !Member.roles.cache.find( + (r) => r.name.toLowerCase() === Role.name.toLowerCase(), + ) + ) { await Member.roles .add( Role, diff --git a/src/modules/reactionRoles/interfaces/IReactionRoleRepository.ts b/src/modules/reactionRoles/interfaces/IReactionRoleRepository.ts index c08a88d46..adb2c01b9 100644 --- a/src/modules/reactionRoles/interfaces/IReactionRoleRepository.ts +++ b/src/modules/reactionRoles/interfaces/IReactionRoleRepository.ts @@ -4,14 +4,25 @@ import type { IReaction, REACTION_OPTIONS } from "../types"; export interface IReactionRolesRepository { getAll(guild: Guild): Promise; - getOne(guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction): Promise; - getInChannel(guild: Guild, channel: TextChannel): Promise; + getOne( + guild: Guild, + { Channel, Message, Role, Emoji, Option }: IReaction, + ): Promise; + getInChannel( + guild: Guild, + channel: TextChannel, + ): Promise; create( guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction, ): Promise<{ status: "UnableToCreate" | "Created" }>; - delete(guild: Guild, { Channel, Message, Role, Emoji }: IReaction): Promise<{ status: "UnableToDelete" | "Deleted" }>; - deleteMany(guild: Guild): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }>; + delete( + guild: Guild, + { Channel, Message, Role, Emoji }: IReaction, + ): Promise<{ status: "UnableToDelete" | "Deleted" }>; + deleteMany( + guild: Guild, + ): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }>; update( guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction, diff --git a/src/modules/reactionRoles/interfaces/IReactionRolesEmbeds.ts b/src/modules/reactionRoles/interfaces/IReactionRolesEmbeds.ts index d6a16d1d8..51100e3d3 100644 --- a/src/modules/reactionRoles/interfaces/IReactionRolesEmbeds.ts +++ b/src/modules/reactionRoles/interfaces/IReactionRolesEmbeds.ts @@ -11,7 +11,10 @@ export interface IReactionRolesEmbeds { interaction: CommandInteraction, { Channel, Message, Role, Emoji, Option }: IReaction, ): Promise; - ReactionRoleRemovedEmbed(interaction: CommandInteraction, MsgID: Message): Promise; + ReactionRoleRemovedEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise; ReactionRoleUpdatedEmbed( interaction: CommandInteraction, { Channel, Message, Role, Emoji }: IReaction, @@ -22,8 +25,18 @@ export interface IReactionRolesEmbeds { status: "Confirm" | "Cancel" | "Success", ReactionCount: number | null, ): Promise; - UnableToCreateReactionRoleEmbed(interaction: CommandInteraction): Promise; - UnableToDeleteReactionRoleEmbed(interaction: CommandInteraction, MsgID: Message): Promise; - UnableToDeleteAllReactionRoleEmbed(interaction: CommandInteraction): Promise; - UnableToUpdateReactionRoleEmbed(interaction: CommandInteraction, MsgID: Message): Promise; + UnableToCreateReactionRoleEmbed( + interaction: CommandInteraction, + ): Promise; + UnableToDeleteReactionRoleEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise; + UnableToDeleteAllReactionRoleEmbed( + interaction: CommandInteraction, + ): Promise; + UnableToUpdateReactionRoleEmbed( + interaction: CommandInteraction, + MsgID: Message, + ): Promise; } diff --git a/src/modules/reactionRoles/interfaces/IReactionRolesService.ts b/src/modules/reactionRoles/interfaces/IReactionRolesService.ts index cd57e31a9..a7e081b45 100644 --- a/src/modules/reactionRoles/interfaces/IReactionRolesService.ts +++ b/src/modules/reactionRoles/interfaces/IReactionRolesService.ts @@ -1,4 +1,11 @@ -import { Client, CommandInteraction, EmbedBuilder, Guild, Message, Role, TextChannel } from "discord.js"; +import { + Client, + CommandInteraction, + Guild, + Message, + Role, + TextChannel, +} from "discord.js"; import { ReactionRolesEntity } from "../entities/ReactionRole.entity"; import type { IReaction, REACTION_OPTIONS } from "../types"; import type { IReactionRolesEmbeds } from "./IReactionRolesEmbeds"; @@ -6,14 +13,25 @@ import type { IReactionRolesEmbeds } from "./IReactionRolesEmbeds"; export interface IReactionRolesService { Embeds(): Promise; getAll(guild: Guild): Promise; - getInChannel(guild: Guild, channel: TextChannel): Promise; - getOne(guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction): Promise; + getInChannel( + guild: Guild, + channel: TextChannel, + ): Promise; + getOne( + guild: Guild, + { Channel, Message, Role, Emoji, Option }: IReaction, + ): Promise; Create( guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction, ): Promise<{ status: "UnableToCreate" | "Created" }>; - Delete(guild: Guild, { Channel, Message, Role, Emoji }: IReaction): Promise<{ status: "UnableToDelete" | "Deleted" }>; - DeleteAll(guild: Guild): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }>; + Delete( + guild: Guild, + { Channel, Message, Role, Emoji }: IReaction, + ): Promise<{ status: "UnableToDelete" | "Deleted" }>; + DeleteAll( + guild: Guild, + ): Promise<{ status: "UnableToDelete" | "Deleted"; count: number }>; Update( guild: Guild, { Channel, Message, Role, Emoji, Option }: IReaction, diff --git a/src/utils/Tools.ts b/src/utils/Tools.ts index 4595e83a9..2f15a518b 100644 --- a/src/utils/Tools.ts +++ b/src/utils/Tools.ts @@ -2,7 +2,6 @@ import util from "node:util"; import { NestedLocalizationAdapter, TranslationFn } from "@necord/localization"; import { BaseMessageOptions, - CommandInteraction, EmbedBuilder, MessageEditOptions, } from "discord.js";