Reformat using prettier
diff --git a/src/utils/calculate.ts b/src/utils/calculate.ts
index fde1340..61e0cb2 100644
--- a/src/utils/calculate.ts
+++ b/src/utils/calculate.ts
@@ -17,14 +17,16 @@
"webhookUpdate",
"guildMemberVerify",
"autoModeratorDeleted",
- "ticketUpdate",
+ "ticketUpdate"
// "nucleusSettingsUpdated"
];
const tickets = ["support", "report", "question", "issue", "suggestion", "other"];
const toHexInteger = (permissions: string[], array?: string[]): string => {
- if (!array) { array = logs; }
+ if (!array) {
+ array = logs;
+ }
let int = 0n;
for (const perm of permissions) {
diff --git a/src/utils/client.ts b/src/utils/client.ts
index b1fa31f..f443d24 100644
--- a/src/utils/client.ts
+++ b/src/utils/client.ts
@@ -1,13 +1,12 @@
-import Discord, { Client, Interaction, AutocompleteInteraction, Collection } from 'discord.js';
+import Discord, { Client, Interaction, AutocompleteInteraction, Collection } from "discord.js";
import { Logger } from "../utils/log.js";
import Memory from "../utils/memory.js";
import type { VerifySchema } from "../reflex/verify.js";
-import { Guilds, History, ModNotes, Premium, PerformanceTest, ScanCache, Transcript, } from "../utils/database.js";
+import { Guilds, History, ModNotes, Premium, PerformanceTest, ScanCache, Transcript } from "../utils/database.js";
import EventScheduler from "../utils/eventScheduler.js";
import type { RoleMenuSchema } from "../actions/roleMenu.js";
import config from "../config/main.js";
-
class NucleusClient extends Client {
logger = Logger;
config: typeof config = config;
@@ -23,20 +22,35 @@
eventScheduler: EventScheduler;
performanceTest: PerformanceTest;
scanCache: ScanCache;
- transcripts: Transcript
+ transcripts: Transcript;
};
- preloadPage: Record<string, {command: string, argument: string}> = {}; // e.g. { channelID: { command: privacy, page: 3}}
- commands: Record<string, [{
- command: Discord.SlashCommandBuilder |
- ((builder: Discord.SlashCommandBuilder) => Discord.SlashCommandBuilder) |
- Discord.SlashCommandSubcommandBuilder | ((builder: Discord.SlashCommandSubcommandBuilder) => Discord.SlashCommandSubcommandBuilder) | Discord.SlashCommandSubcommandGroupBuilder | ((builder: Discord.SlashCommandSubcommandGroupBuilder) => Discord.SlashCommandSubcommandGroupBuilder),
- callback: (interaction: Interaction) => Promise<void>,
- check: (interaction: Interaction, partial: boolean) => Promise<boolean> | boolean,
- autocomplete: (interaction: AutocompleteInteraction) => Promise<string[]>
- } | undefined, {name: string, description: string}]> = {};
+ preloadPage: Record<string, { command: string; argument: string }> = {}; // e.g. { channelID: { command: privacy, page: 3}}
+ commands: Record<
+ string,
+ [
+ (
+ | {
+ command:
+ | Discord.SlashCommandBuilder
+ | ((builder: Discord.SlashCommandBuilder) => Discord.SlashCommandBuilder)
+ | Discord.SlashCommandSubcommandBuilder
+ | ((builder: Discord.SlashCommandSubcommandBuilder) => Discord.SlashCommandSubcommandBuilder)
+ | Discord.SlashCommandSubcommandGroupBuilder
+ | ((
+ builder: Discord.SlashCommandSubcommandGroupBuilder
+ ) => Discord.SlashCommandSubcommandGroupBuilder);
+ callback: (interaction: Interaction) => Promise<void>;
+ check: (interaction: Interaction, partial: boolean) => Promise<boolean> | boolean;
+ autocomplete: (interaction: AutocompleteInteraction) => Promise<string[]>;
+ }
+ | undefined
+ ),
+ { name: string; description: string }
+ ]
+ > = {};
fetchedCommands = new Collection<string, Discord.ApplicationCommand>();
constructor(database: typeof NucleusClient.prototype.database) {
- super({ intents: 0b1100011011011111111111});
+ super({ intents: 0b1100011011011111111111 });
this.database = database;
}
}
@@ -52,4 +66,4 @@
});
export default client;
-export { NucleusClient };
\ No newline at end of file
+export { NucleusClient };
diff --git a/src/utils/commandRegistration/getFilesInFolder.ts b/src/utils/commandRegistration/getFilesInFolder.ts
index 875e0b0..f5131bb 100644
--- a/src/utils/commandRegistration/getFilesInFolder.ts
+++ b/src/utils/commandRegistration/getFilesInFolder.ts
@@ -1,9 +1,9 @@
import fs from "fs";
export default async function getSubcommandsInFolder(path: string, indent: string = "") {
- const files = fs.readdirSync(path, { withFileTypes: true }).filter(
- file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
- );
+ const files = fs
+ .readdirSync(path, { withFileTypes: true })
+ .filter((file) => !file.name.endsWith(".ts") && !file.name.endsWith(".map"));
const subcommands = [];
const subcommandGroups = [];
let errors = 0;
@@ -15,7 +15,7 @@
subcommandGroups.push(await import(`../../../${path}/${file.name}/_meta.js`));
} else if (file.name.endsWith(".js")) {
// If its a file
- console.log(`│ ${indent}├─ Loading subcommand ${file.name}`)
+ console.log(`│ ${indent}├─ Loading subcommand ${file.name}`);
subcommands.push(await import(`../../../${path}/${file.name}`));
}
} catch (e) {
@@ -23,5 +23,5 @@
errors++;
}
}
- return {subcommands, subcommandGroups, errors};
+ return { subcommands, subcommandGroups, errors };
}
diff --git a/src/utils/commandRegistration/register.ts b/src/utils/commandRegistration/register.ts
index 33c88b0..fbd052f 100644
--- a/src/utils/commandRegistration/register.ts
+++ b/src/utils/commandRegistration/register.ts
@@ -1,10 +1,10 @@
-import type { CommandInteraction } from 'discord.js';
-import Discord, { Interaction, SlashCommandBuilder, ApplicationCommandType } from 'discord.js';
+import type { CommandInteraction } from "discord.js";
+import Discord, { Interaction, SlashCommandBuilder, ApplicationCommandType } from "discord.js";
import config from "../../config/main.js";
import client from "../client.js";
import fs from "fs";
-import EmojiEmbed from '../generateEmojiEmbed.js';
-import getEmojiByName from '../getEmojiByName.js';
+import EmojiEmbed from "../generateEmojiEmbed.js";
+import getEmojiByName from "../getEmojiByName.js";
const colors = {
red: "\x1b[31m",
@@ -13,163 +13,207 @@
blue: "\x1b[34m",
purple: "\x1b[35m",
none: "\x1b[0m"
-}
+};
async function registerCommands() {
const commands = [];
- const files: fs.Dirent[] = fs.readdirSync(config.commandsFolder, { withFileTypes: true }).filter(
- file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
- );
- console.log(`Registering ${files.length} commands`)
+ const files: fs.Dirent[] = fs
+ .readdirSync(config.commandsFolder, { withFileTypes: true })
+ .filter((file) => !file.name.endsWith(".ts") && !file.name.endsWith(".map"));
+ console.log(`Registering ${files.length} commands`);
let i = 0;
for (const file of files) {
const last = i === files.length - 1 ? "└" : "├";
if (file.isDirectory()) {
- console.log(`${last}─ ${colors.yellow}Loading subcommands of ${file.name}${colors.none}`)
- const fetched = (await import(`../../../${config.commandsFolder}/${file.name}/_meta.js`));
+ console.log(`${last}─ ${colors.yellow}Loading subcommands of ${file.name}${colors.none}`);
+ const fetched = await import(`../../../${config.commandsFolder}/${file.name}/_meta.js`);
commands.push(fetched.command);
} else if (file.name.endsWith(".js")) {
- console.log(`${last}─ ${colors.yellow}Loading command ${file.name}${colors.none}`)
- const fetched = (await import(`../../../${config.commandsFolder}/${file.name}`));
- fetched.command.setDMPermission(fetched.allowedInDMs ?? false)
- fetched.command.setNameLocalizations(fetched.nameLocalizations ?? {})
- fetched.command.setDescriptionLocalizations(fetched.descriptionLocalizations ?? {})
+ console.log(`${last}─ ${colors.yellow}Loading command ${file.name}${colors.none}`);
+ const fetched = await import(`../../../${config.commandsFolder}/${file.name}`);
+ fetched.command.setDMPermission(fetched.allowedInDMs ?? false);
+ fetched.command.setNameLocalizations(fetched.nameLocalizations ?? {});
+ fetched.command.setDescriptionLocalizations(fetched.descriptionLocalizations ?? {});
// if (fetched.nameLocalizations || fetched.descriptionLocalizations)
commands.push(fetched.command);
client.commands["commands/" + fetched.command.name] = [
fetched,
- {name: fetched.name ?? fetched.command.name, description: fetched.description ?? fetched.command.description}
+ {
+ name: fetched.name ?? fetched.command.name,
+ description: fetched.description ?? fetched.command.description
+ }
];
}
i++;
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${files.length}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${
+ files.length
+ }]${colors.none}`
+ );
}
- console.log(`${colors.yellow}Loaded ${commands.length} commands, processing...`)
- const processed = []
+ console.log(`${colors.yellow}Loaded ${commands.length} commands, processing...`);
+ const processed = [];
for (const subcommand of commands) {
if (subcommand instanceof Function) {
- processed.push(subcommand(new SlashCommandBuilder()))
+ processed.push(subcommand(new SlashCommandBuilder()));
} else {
- processed.push(subcommand)
+ processed.push(subcommand);
}
}
- console.log(`${colors.green}Processed ${processed.length} commands${colors.none}`)
+ console.log(`${colors.green}Processed ${processed.length} commands${colors.none}`);
return processed;
-
-};
+}
async function registerEvents() {
- console.log("Reading events")
- const files = fs.readdirSync(config.eventsFolder, { withFileTypes: true }).filter(
- file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
- );
- console.log(`Registering ${files.length} events`)
+ console.log("Reading events");
+ const files = fs
+ .readdirSync(config.eventsFolder, { withFileTypes: true })
+ .filter((file) => !file.name.endsWith(".ts") && !file.name.endsWith(".map"));
+ console.log(`Registering ${files.length} events`);
let i = 0;
let errors = 0;
for (const file of files) {
const last = i === files.length - 1 ? "└" : "├";
i++;
try {
- console.log(`${last}─ ${colors.yellow}Loading event ${file.name}${colors.none}`)
- const event = (await import(`../../../${config.eventsFolder}/${file.name}`));
+ console.log(`${last}─ ${colors.yellow}Loading event ${file.name}${colors.none}`);
+ const event = await import(`../../../${config.eventsFolder}/${file.name}`);
client.on(event.event, event.callback.bind(null, client));
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${files.length}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${
+ files.length
+ }]${colors.none}`
+ );
} catch (e) {
errors++;
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${file.name} [${i} / ${files.length}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${file.name} [${i} / ${
+ files.length
+ }]${colors.none}`
+ );
}
}
- console.log(`Loaded ${files.length - errors} events (${errors} failed)`)
-};
+ console.log(`Loaded ${files.length - errors} events (${errors} failed)`);
+}
async function registerContextMenus() {
- console.log("Reading context menus")
- const messageFiles = fs.readdirSync(config.messageContextFolder, { withFileTypes: true }).filter(
- file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
- );
- const userFiles = fs.readdirSync(config.userContextFolder, { withFileTypes: true }).filter(
- file => !file.name.endsWith(".ts") && !file.name.endsWith(".map")
- );
- console.log(`Registering ${messageFiles.length} message context menus and ${userFiles.length} user context menus`)
+ console.log("Reading context menus");
+ const messageFiles = fs
+ .readdirSync(config.messageContextFolder, { withFileTypes: true })
+ .filter((file) => !file.name.endsWith(".ts") && !file.name.endsWith(".map"));
+ const userFiles = fs
+ .readdirSync(config.userContextFolder, { withFileTypes: true })
+ .filter((file) => !file.name.endsWith(".ts") && !file.name.endsWith(".map"));
+ console.log(`Registering ${messageFiles.length} message context menus and ${userFiles.length} user context menus`);
let i = 0;
let errors = 0;
- const commands: (Discord.ContextMenuCommandBuilder)[] = []
+ const commands: Discord.ContextMenuCommandBuilder[] = [];
const totalFiles = messageFiles.length + userFiles.length;
for (const file of messageFiles) {
const last = i === totalFiles - 1 ? "└" : "├";
i++;
try {
- console.log(`${last}─ ${colors.yellow}Loading message context menu ${file.name}${colors.none}`)
- const context = (await import(`../../../${config.messageContextFolder}/${file.name}`));
+ console.log(`${last}─ ${colors.yellow}Loading message context menu ${file.name}${colors.none}`);
+ const context = await import(`../../../${config.messageContextFolder}/${file.name}`);
context.command.setType(ApplicationCommandType.Message);
- context.command.setDMPermission(context.allowedInDMs ?? false)
- context.command.setNameLocalizations(context.nameLocalizations ?? {})
+ context.command.setDMPermission(context.allowedInDMs ?? false);
+ context.command.setNameLocalizations(context.nameLocalizations ?? {});
commands.push(context.command);
- client.commands["contextCommands/message/" + context.command.name] = [context, {name: context.name ?? context.command.name, description: context.description ?? context.command.description}];
+ client.commands["contextCommands/message/" + context.command.name] = [
+ context,
+ {
+ name: context.name ?? context.command.name,
+ description: context.description ?? context.command.description
+ }
+ ];
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${totalFiles}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${
+ file.name
+ } [${i} / ${totalFiles}]${colors.none}`
+ );
} catch (e) {
errors++;
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${file.name} [${i} / ${totalFiles}] | ${e}${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${
+ file.name
+ } [${i} / ${totalFiles}] | ${e}${colors.none}`
+ );
}
}
for (const file of userFiles) {
const last = i === totalFiles - 1 ? "└" : "├";
i++;
try {
- console.log(`${last}─ ${colors.yellow}Loading user context menu ${file.name}${colors.none}`)
- const context = (await import(`../../../${config.userContextFolder}/${file.name}`));
+ console.log(`${last}─ ${colors.yellow}Loading user context menu ${file.name}${colors.none}`);
+ const context = await import(`../../../${config.userContextFolder}/${file.name}`);
context.command.setType(ApplicationCommandType.User);
commands.push(context.command);
client.commands["contextCommands/user/" + context.command.name] = context;
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${file.name} [${i} / ${totalFiles}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.green}Loaded ${
+ file.name
+ } [${i} / ${totalFiles}]${colors.none}`
+ );
} catch (e) {
errors++;
- console.log(`${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${file.name} [${i} / ${totalFiles}]${colors.none}`)
+ console.log(
+ `${last.replace("└", " ").replace("├", "│")} └─ ${colors.red}Failed to load ${
+ file.name
+ } [${i} / ${totalFiles}]${colors.none}`
+ );
}
}
- console.log(`Loaded ${messageFiles.length + userFiles.length - errors} context menus (${errors} failed)`)
+ console.log(`Loaded ${messageFiles.length + userFiles.length - errors} context menus (${errors} failed)`);
return commands;
-};
+}
async function registerCommandHandler() {
client.on("interactionCreate", async (interaction: Interaction) => {
- if (interaction.isUserContextMenuCommand()) {;
+ if (interaction.isUserContextMenuCommand()) {
const commandName = "contextCommands/user/" + interaction.commandName;
- execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction)
+ execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
return;
} else if (interaction.isMessageContextMenuCommand()) {
const commandName = "contextCommands/message/" + interaction.commandName;
- execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction)
+ execute(client.commands[commandName]![0]?.check, client.commands[commandName]![0]?.callback, interaction);
return;
} else if (interaction.isAutocomplete()) {
const commandName = interaction.commandName;
const subcommandGroupName = interaction.options.getSubcommandGroup(false);
const subcommandName = interaction.options.getSubcommand(false);
- const fullCommandName = "commands/" + commandName + (subcommandGroupName ? `/${subcommandGroupName}` : "") + (subcommandName ? `/${subcommandName}` : "");
+ const fullCommandName =
+ "commands/" +
+ commandName +
+ (subcommandGroupName ? `/${subcommandGroupName}` : "") +
+ (subcommandName ? `/${subcommandName}` : "");
const choices = await client.commands[fullCommandName]![0]?.autocomplete(interaction);
- const formatted = (choices ?? []).map(choice => {
- return { name: choice, value: choice }
- })
- interaction.respond(formatted)
+ const formatted = (choices ?? []).map((choice) => {
+ return { name: choice, value: choice };
+ });
+ interaction.respond(formatted);
} else if (interaction.isChatInputCommand()) {
const commandName = interaction.commandName;
const subcommandGroupName = interaction.options.getSubcommandGroup(false);
const subcommandName = interaction.options.getSubcommand(false);
- const fullCommandName = "commands/" + commandName + (subcommandGroupName ? `/${subcommandGroupName}` : "") + (subcommandName ? `/${subcommandName}` : "");
+ const fullCommandName =
+ "commands/" +
+ commandName +
+ (subcommandGroupName ? `/${subcommandGroupName}` : "") +
+ (subcommandName ? `/${subcommandName}` : "");
// console.log(fullCommandName, client.commands[fullCommandName])
const command = client.commands[fullCommandName]![0];
@@ -187,34 +231,37 @@
let result;
try {
result = await check(data);
- } catch(e) {
+ } catch (e) {
result = false;
}
if (result === false) return;
if (typeof result === "string") {
- const { NucleusColors } = client.logger
- return data.reply({embeds: [new EmojiEmbed()
- .setDescription(result)
- .setColor(NucleusColors.red)
- .setEmoji(getEmojiByName("CONTROL.BLOCKCROSS"))
- ], ephemeral: true});
+ const { NucleusColors } = client.logger;
+ return data.reply({
+ embeds: [
+ new EmojiEmbed()
+ .setDescription(result)
+ .setColor(NucleusColors.red)
+ .setEmoji(getEmojiByName("CONTROL.BLOCKCROSS"))
+ ],
+ ephemeral: true
+ });
}
}
callback(data);
}
-
export default async function register() {
- let commandList: ( Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder )[] = [];
+ let commandList: (Discord.SlashCommandBuilder | Discord.ContextMenuCommandBuilder)[] = [];
commandList = commandList.concat(await registerCommands());
commandList = commandList.concat(await registerContextMenus());
if (process.argv.includes("--update-commands")) {
if (config.enableDevelopment) {
const guild = await client.guilds.fetch(config.developmentGuildID);
- console.log(`${colors.purple}Registering commands in ${guild!.name}${colors.none}`)
+ console.log(`${colors.purple}Registering commands in ${guild!.name}${colors.none}`);
await guild.commands.set(commandList);
} else {
- console.log(`${colors.blue}Registering commands in production mode${colors.none}`)
+ console.log(`${colors.blue}Registering commands in production mode${colors.none}`);
const guild = await client.guilds.fetch(config.developmentGuildID);
await guild.commands.set([]);
await client.application?.commands.set(commandList);
@@ -222,9 +269,10 @@
}
await registerCommandHandler();
await registerEvents();
- console.log(`${colors.green}Registered commands, events and context menus${colors.none}`)
+ console.log(`${colors.green}Registered commands, events and context menus${colors.none}`);
console.log(
- (config.enableDevelopment ? `${colors.purple}Bot started in Development mode` :
- `${colors.blue}Bot started in Production mode`) + colors.none
- )
-};
+ (config.enableDevelopment
+ ? `${colors.purple}Bot started in Development mode`
+ : `${colors.blue}Bot started in Production mode`) + colors.none
+ );
+}
diff --git a/src/utils/commandRegistration/slashCommandBuilder.ts b/src/utils/commandRegistration/slashCommandBuilder.ts
index 66291b3..edfdfb7 100644
--- a/src/utils/commandRegistration/slashCommandBuilder.ts
+++ b/src/utils/commandRegistration/slashCommandBuilder.ts
@@ -5,13 +5,11 @@
import client from "../client.js";
import Discord from "discord.js";
-
const colors = {
red: "\x1b[31m",
green: "\x1b[32m",
none: "\x1b[0m"
-}
-
+};
export async function group(
name: string,
@@ -21,21 +19,30 @@
descriptionLocalizations?: Record<string, string>
) {
// If the name of the command does not match the path (e.g. attachment.ts has /attachments), use commandString
- console.log(`│ ├─ Loading group ${name}`)
- const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path, "│ ")
- console.log(`│ │ └─ ${fetched.errors ? colors.red : colors.green}Loaded ${fetched.subcommands.length} subcommands for ${name} (${fetched.errors} failed)${colors.none}`)
+ console.log(`│ ├─ Loading group ${name}`);
+ const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path, "│ ");
+ console.log(
+ `│ │ └─ ${fetched.errors ? colors.red : colors.green}Loaded ${
+ fetched.subcommands.length
+ } subcommands for ${name} (${fetched.errors} failed)${colors.none}`
+ );
return (subcommandGroup: SlashCommandSubcommandGroupBuilder) => {
- subcommandGroup
- .setName(name)
- .setDescription(description)
- if (nameLocalizations) { subcommandGroup.setNameLocalizations(nameLocalizations) }
- if (descriptionLocalizations) { subcommandGroup.setDescriptionLocalizations(descriptionLocalizations) }
+ subcommandGroup.setName(name).setDescription(description);
+ if (nameLocalizations) {
+ subcommandGroup.setNameLocalizations(nameLocalizations);
+ }
+ if (descriptionLocalizations) {
+ subcommandGroup.setDescriptionLocalizations(descriptionLocalizations);
+ }
for (const subcommand of fetched.subcommands) {
const processedCommand = subcommand.command(new SlashCommandSubcommandBuilder());
- client.commands["commands/" + path + "/" + processedCommand.name] = [subcommand, { name: processedCommand.name, description: processedCommand.description }]
+ client.commands["commands/" + path + "/" + processedCommand.name] = [
+ subcommand,
+ { name: processedCommand.name, description: processedCommand.description }
+ ];
subcommandGroup.addSubcommand(processedCommand);
- };
+ }
return subcommandGroup;
};
@@ -54,19 +61,23 @@
// If the name of the command does not match the path (e.g. attachment.ts has /attachments), use commandString
commandString = "commands/" + (commandString ?? path);
const fetched = await getSubcommandsInFolder(config.commandsFolder + "/" + path);
- console.log(`│ ├─ ${fetched.errors ? colors.red : colors.green}Loaded ${fetched.subcommands.length} subcommands and ${fetched.subcommandGroups.length} subcommand groups for ${name} (${fetched.errors} failed)${colors.none}`)
+ console.log(
+ `│ ├─ ${fetched.errors ? colors.red : colors.green}Loaded ${fetched.subcommands.length} subcommands and ${
+ fetched.subcommandGroups.length
+ } subcommand groups for ${name} (${fetched.errors} failed)${colors.none}`
+ );
// console.log({name: name, description: description})
- client.commands[commandString!] = [undefined, { name: name, description: description }]
+ client.commands[commandString!] = [undefined, { name: name, description: description }];
return (command: SlashCommandBuilder) => {
- command.setName(name)
- command.setDescription(description)
- command.setNameLocalizations(nameLocalizations ?? {})
- command.setDescriptionLocalizations(descriptionLocalizations ?? {})
- command.setDMPermission(allowedInDMs ?? false)
+ command.setName(name);
+ command.setDescription(description);
+ command.setNameLocalizations(nameLocalizations ?? {});
+ command.setDescriptionLocalizations(descriptionLocalizations ?? {});
+ command.setDMPermission(allowedInDMs ?? false);
if (userPermissions) {
- const bitfield = new Discord.PermissionsBitField()
- bitfield.add(userPermissions)
- command.setDefaultMemberPermissions(bitfield.bitfield)
+ const bitfield = new Discord.PermissionsBitField();
+ bitfield.add(userPermissions);
+ command.setDefaultMemberPermissions(bitfield.bitfield);
}
for (const subcommand of fetched.subcommands) {
@@ -76,14 +87,20 @@
} else {
fetchedCommand = subcommand.command;
}
- client.commands[commandString! + "/" + fetchedCommand.name] = [subcommand, { name: fetchedCommand.name, description: fetchedCommand.description }]
+ client.commands[commandString! + "/" + fetchedCommand.name] = [
+ subcommand,
+ { name: fetchedCommand.name, description: fetchedCommand.description }
+ ];
command.addSubcommand(fetchedCommand);
}
for (const group of fetched.subcommandGroups) {
const processedCommand = group.command(new SlashCommandSubcommandGroupBuilder());
- client.commands[commandString! + "/" + processedCommand.name] = [undefined, { name: processedCommand.name, description: processedCommand.description }]
+ client.commands[commandString! + "/" + processedCommand.name] = [
+ undefined,
+ { name: processedCommand.name, description: processedCommand.description }
+ ];
command.addSubcommandGroup(processedCommand);
- };
+ }
return command;
};
}
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index f7cccaf..05c5494 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -62,7 +62,11 @@
this.inverted = inverted;
return this;
}
- setFailedMessage(text: string, failedStatus: "Success" | "Danger" | "Warning" | null, failedEmoji: string | null = null) {
+ setFailedMessage(
+ text: string,
+ failedStatus: "Success" | "Danger" | "Warning" | null,
+ failedEmoji: string | null = null
+ ) {
this.failedMessage = text;
this.failedStatus = failedStatus;
this.failedEmoji = failedEmoji;
@@ -138,10 +142,14 @@
);
const components = [];
for (let i = 0; i < fullComponents.length; i += 5) {
- components.push(new ActionRowBuilder<
- Discord.ButtonBuilder | Discord.StringSelectMenuBuilder |
- Discord.RoleSelectMenuBuilder | Discord.UserSelectMenuBuilder
- >().addComponents(fullComponents.slice(i, i + 5)));
+ components.push(
+ new ActionRowBuilder<
+ | Discord.ButtonBuilder
+ | Discord.StringSelectMenuBuilder
+ | Discord.RoleSelectMenuBuilder
+ | Discord.UserSelectMenuBuilder
+ >().addComponents(fullComponents.slice(i, i + 5))
+ );
}
const object = {
embeds: [
@@ -158,7 +166,8 @@
} else {
return v.notValue ? `*${v.notValue}*\n` : "";
}
- }).join("")
+ })
+ .join("")
)
.setStatus(this.color)
],
@@ -181,7 +190,8 @@
let component;
try {
component = await m.awaitMessageComponent({
- filter: (i) => i.user.id === this.interaction.user.id && i.channel!.id === this.interaction.channel!.id,
+ filter: (i) =>
+ i.user.id === this.interaction.user.id && i.channel!.id === this.interaction.channel!.id,
time: 300000
});
} catch (e) {
@@ -244,12 +254,15 @@
});
let out;
try {
- out = await modalInteractionCollector(m, this.interaction.user) as Discord.ModalSubmitInteraction | null;
+ out = (await modalInteractionCollector(
+ m,
+ this.interaction.user
+ )) as Discord.ModalSubmitInteraction | null;
} catch (e) {
cancelled = true;
continue;
}
- if (out === null || out.isButton()) {
+ if (out === null || out.isButton()) {
cancelled = true;
continue;
}
@@ -270,28 +283,31 @@
const returnValue: Awaited<ReturnType<typeof this.send>> = {};
if (cancelled) {
- await this.timeoutError()
+ await this.timeoutError();
returnValue.cancelled = true;
}
if (success === false) {
await this.interaction.editReply({
- embeds: [new EmojiEmbed()
- .setTitle(this.title)
- .setDescription(this.failedMessage ?? "*Message timed out*")
- .setStatus(this.failedStatus ?? "Danger")
- .setEmoji(this.failedEmoji ?? this.redEmoji ?? this.emoji)
- ], components: []
+ embeds: [
+ new EmojiEmbed()
+ .setTitle(this.title)
+ .setDescription(this.failedMessage ?? "*Message timed out*")
+ .setStatus(this.failedStatus ?? "Danger")
+ .setEmoji(this.failedEmoji ?? this.redEmoji ?? this.emoji)
+ ],
+ components: []
});
- return {success: false}
+ return { success: false };
}
if (returnComponents || success !== undefined) returnValue.components = this.customButtons;
if (success !== undefined) returnValue.success = success;
if (newReason) returnValue.newReason = newReason;
- const typedReturnValue = returnValue as {cancelled: true} |
- { success: boolean, components: Record<string, CustomBoolean<unknown>>, newReason?: string} |
- { newReason: string, components: Record<string, CustomBoolean<unknown>> } |
- { components: Record<string, CustomBoolean<unknown>> };
+ const typedReturnValue = returnValue as
+ | { cancelled: true }
+ | { success: boolean; components: Record<string, CustomBoolean<unknown>>; newReason?: string }
+ | { newReason: string; components: Record<string, CustomBoolean<unknown>> }
+ | { components: Record<string, CustomBoolean<unknown>> };
return typedReturnValue;
}
@@ -306,7 +322,7 @@
.setEmoji("CONTROL.BLOCKCROSS")
],
components: []
- })
+ });
}
}
diff --git a/src/utils/createPageIndicator.ts b/src/utils/createPageIndicator.ts
index 6bc86a4..e16422d 100644
--- a/src/utils/createPageIndicator.ts
+++ b/src/utils/createPageIndicator.ts
@@ -2,16 +2,17 @@
function pageIndicator(amount: number, selected: number, showDetails?: boolean, disabled?: boolean | string) {
let out = "";
- disabled = disabled ? "GRAY." : ""
+ disabled = disabled ? "GRAY." : "";
if (amount === 1) {
- out += getEmojiByName("TRACKS.SINGLE." + (disabled) + (selected === 0 ? "ACTIVE" : "INACTIVE"));
+ out += getEmojiByName("TRACKS.SINGLE." + disabled + (selected === 0 ? "ACTIVE" : "INACTIVE"));
} else {
for (let i = 0; i < amount; i++) {
out += getEmojiByName(
"TRACKS.HORIZONTAL." +
- (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
- "." + (disabled) +
- (i === selected ? "ACTIVE" : "INACTIVE")
+ (i === 0 ? "LEFT" : i === amount - 1 ? "RIGHT" : "MIDDLE") +
+ "." +
+ disabled +
+ (i === selected ? "ACTIVE" : "INACTIVE")
);
}
}
@@ -21,7 +22,12 @@
return out;
}
-export const verticalTrackIndicator = (position: number, active: string | boolean, size: number, disabled: string | boolean) => {
+export const verticalTrackIndicator = (
+ position: number,
+ active: string | boolean,
+ size: number,
+ disabled: string | boolean
+) => {
active = active ? "ACTIVE" : "INACTIVE";
disabled = disabled ? "GRAY." : "";
if (position === 0 && size === 1) return "TRACKS.SINGLE." + disabled + active;
@@ -38,6 +44,6 @@
out += items[i] + "\n";
}
return out;
-}
+};
export default pageIndicator;
diff --git a/src/utils/createTemporaryStorage.ts b/src/utils/createTemporaryStorage.ts
index e8a8073..af41672 100644
--- a/src/utils/createTemporaryStorage.ts
+++ b/src/utils/createTemporaryStorage.ts
@@ -21,12 +21,12 @@
client.preloadPage[target] = {
command: command,
argument: message
- }
+ };
setTimeout(() => {
const object = Object.entries(client.preloadPage).filter((entry) => {
- const [k, _] = entry
+ const [k, _] = entry;
return k !== target;
- })
+ });
client.preloadPage = Object.fromEntries(object);
}, 60 * 5 * 1000);
}
diff --git a/src/utils/database.ts b/src/utils/database.ts
index a60cf74..e867775 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -1,23 +1,34 @@
-import { ButtonStyle, CommandInteraction, ComponentType, GuildMember, Message, MessageComponentInteraction } from "discord.js";
+import {
+ ButtonStyle,
+ CommandInteraction,
+ ComponentType,
+ GuildMember,
+ Message,
+ MessageComponentInteraction
+} from "discord.js";
import type Discord from "discord.js";
import { Collection, MongoClient } from "mongodb";
import config from "../config/main.js";
import client from "../utils/client.js";
import * as crypto from "crypto";
import _ from "lodash";
-import defaultData from '../config/default.js';
+import defaultData from "../config/default.js";
const username = encodeURIComponent(config.mongoOptions.username);
const password = encodeURIComponent(config.mongoOptions.password);
-const mongoClient = new MongoClient(username ? `mongodb://${username}:${password}@${config.mongoOptions.host}?authMechanism=DEFAULT` : `mongodb://${config.mongoOptions.host}`, {authSource: config.mongoOptions.authSource});
+const mongoClient = new MongoClient(
+ username
+ ? `mongodb://${username}:${password}@${config.mongoOptions.host}?authMechanism=DEFAULT`
+ : `mongodb://${config.mongoOptions.host}`,
+ { authSource: config.mongoOptions.authSource }
+);
await mongoClient.connect();
const database = mongoClient.db();
const collectionOptions = { authdb: config.mongoOptions.authSource, w: "majority" };
const getIV = () => crypto.randomBytes(16);
-
export class Guilds {
guilds: Collection<GuildConfig>;
defaultData: GuildConfig;
@@ -172,13 +183,13 @@
flags?: string[];
attachments?: TranscriptAttachment[];
stickerURLs?: string[];
- referencedMessage?: string | [string, string, string]; // the message id, the channel id, the guild id
+ referencedMessage?: string | [string, string, string]; // the message id, the channel id, the guild id
}
interface TranscriptSchema {
code: string;
for: TranscriptAuthor;
- type: "ticket" | "purge"
+ type: "ticket" | "purge";
guild: string;
channel: string;
messages: TranscriptMessage[];
@@ -186,7 +197,11 @@
createdBy: TranscriptAuthor;
}
-interface findDocSchema { channelID:string, messageID: string; transcript: string }
+interface findDocSchema {
+ channelID: string;
+ messageID: string;
+ transcript: string;
+}
export class Transcript {
transcripts: Collection<TranscriptSchema>;
@@ -208,21 +223,30 @@
do {
code = crypto.randomBytes(64).toString("base64").replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-");
} while (await this.transcripts.findOne({ code: code }));
- const key = crypto.randomBytes(32**2).toString("base64").replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-").substring(0, 32);
+ const key = crypto
+ .randomBytes(32 ** 2)
+ .toString("base64")
+ .replace(/=/g, "")
+ .replace(/\//g, "_")
+ .replace(/\+/g, "-")
+ .substring(0, 32);
const iv = getIV().toString("base64").replace(/=/g, "").replace(/\//g, "_").replace(/\+/g, "-");
- for(const message of transcript.messages) {
- if(message.content) {
+ for (const message of transcript.messages) {
+ if (message.content) {
const encCipher = crypto.createCipheriv("AES-256-CBC", key, iv);
message.content = encCipher.update(message.content, "utf8", "base64") + encCipher.final("base64");
}
}
const doc = await this.transcripts.insertOne(Object.assign(transcript, { code: code }), collectionOptions);
- if(doc.acknowledged) {
- client.database.eventScheduler.schedule("deleteTranscript", (Date.now() + 1000 * 60 * 60 * 24 * 7).toString(), { guild: transcript.guild, code: code, iv: iv, key: key });
+ if (doc.acknowledged) {
+ client.database.eventScheduler.schedule(
+ "deleteTranscript",
+ (Date.now() + 1000 * 60 * 60 * 24 * 7).toString(),
+ { guild: transcript.guild, code: code, iv: iv, key: key }
+ );
return [code, key, iv];
- }
- else return [null, null, null];
+ } else return [null, null, null];
}
async delete(code: string) {
@@ -242,30 +266,35 @@
// console.log("Transcript read")
let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
let findDoc: findDocSchema | null = null;
- if(!doc) findDoc = (await this.messageToTranscript.findOne({ transcript: code }));
- if(findDoc) {
- const message = await ((client.channels.cache.get(findDoc.channelID)) as Discord.TextBasedChannel | null)?.messages.fetch(findDoc.messageID);
- if(!message) return null;
+ if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
+ if (findDoc) {
+ const message = await (
+ client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
+ )?.messages.fetch(findDoc.messageID);
+ if (!message) return null;
const attachment = message.attachments.first();
- if(!attachment) return null;
+ if (!attachment) return null;
const transcript = (await fetch(attachment.url)).body;
- if(!transcript) return null;
+ if (!transcript) return null;
const reader = transcript.getReader();
let data: Uint8Array | null = null;
let allPacketsReceived = false;
while (!allPacketsReceived) {
const { value, done } = await reader.read();
- if (done) {allPacketsReceived = true; continue;}
- if(!data) {
+ if (done) {
+ allPacketsReceived = true;
+ continue;
+ }
+ if (!data) {
data = value;
} else {
data = new Uint8Array(Buffer.concat([data, value]));
}
}
- if(!data) return null;
+ if (!data) return null;
doc = JSON.parse(Buffer.from(data).toString()) as TranscriptSchema;
}
- if(!doc) return null;
+ if (!doc) return null;
return doc;
}
@@ -273,32 +302,34 @@
// console.log("Transcript read")
let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
let findDoc: findDocSchema | null = null;
- if(!doc) findDoc = (await this.messageToTranscript.findOne({ transcript: code }));
- if(findDoc) {
- const message = await ((client.channels.cache.get(findDoc.channelID)) as Discord.TextBasedChannel | null)?.messages.fetch(findDoc.messageID);
- if(!message) return null;
+ if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
+ if (findDoc) {
+ const message = await (
+ client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
+ )?.messages.fetch(findDoc.messageID);
+ if (!message) return null;
const attachment = message.attachments.first();
- if(!attachment) return null;
+ if (!attachment) return null;
const transcript = (await fetch(attachment.url)).body;
- if(!transcript) return null;
+ if (!transcript) return null;
const reader = transcript.getReader();
let data: Uint8Array | null = null;
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition, no-constant-condition
- while(true) {
+ while (true) {
const { value, done } = await reader.read();
if (done) break;
- if(!data) {
+ if (!data) {
data = value;
} else {
data = new Uint8Array(Buffer.concat([data, value]));
}
}
- if(!data) return null;
+ if (!data) return null;
doc = JSON.parse(Buffer.from(data).toString()) as TranscriptSchema;
}
- if(!doc) return null;
- for(const message of doc.messages) {
- if(message.content) {
+ if (!doc) return null;
+ for (const message of doc.messages) {
+ if (message.content) {
const decCipher = crypto.createDecipheriv("AES-256-CBC", key, iv);
message.content = decCipher.update(message.content, "base64", "utf8") + decCipher.final("utf8");
}
@@ -306,8 +337,12 @@
return doc;
}
- async createTranscript(messages: Message[], interaction: MessageComponentInteraction | CommandInteraction, member: GuildMember) {
- const interactionMember = await interaction.guild?.members.fetch(interaction.user.id)
+ async createTranscript(
+ messages: Message[],
+ interaction: MessageComponentInteraction | CommandInteraction,
+ member: GuildMember
+ ) {
+ const interactionMember = await interaction.guild?.members.fetch(interaction.user.id);
const newOut: Omit<TranscriptSchema, "code"> = {
type: "ticket",
for: {
@@ -317,7 +352,7 @@
topRole: {
color: member!.roles.highest.color
},
- iconURL: member!.user.displayAvatarURL({ forceStatic: true}),
+ iconURL: member!.user.displayAvatarURL({ forceStatic: true }),
bot: member!.user.bot
},
guild: interaction.guild!.id,
@@ -331,12 +366,12 @@
topRole: {
color: interactionMember?.roles.highest.color ?? 0x000000
},
- iconURL: interaction.user.displayAvatarURL({ forceStatic: true}),
+ iconURL: interaction.user.displayAvatarURL({ forceStatic: true }),
bot: interaction.user.bot
}
- }
- if(member.nickname) newOut.for.nickname = member.nickname;
- if(interactionMember?.roles.icon) newOut.createdBy.topRole.badgeURL = interactionMember.roles.icon.iconURL()!;
+ };
+ if (member.nickname) newOut.for.nickname = member.nickname;
+ if (interactionMember?.roles.icon) newOut.createdBy.topRole.badgeURL = interactionMember.roles.icon.iconURL()!;
messages.reverse().forEach((message) => {
const msg: TranscriptMessage = {
id: message.id,
@@ -347,55 +382,67 @@
topRole: {
color: message.member!.roles.highest.color
},
- iconURL: message.member!.user.displayAvatarURL({ forceStatic: true}),
+ iconURL: message.member!.user.displayAvatarURL({ forceStatic: true }),
bot: message.author.bot
},
createdTimestamp: message.createdTimestamp
};
- if(message.member?.nickname) msg.author.nickname = message.member.nickname;
+ if (message.member?.nickname) msg.author.nickname = message.member.nickname;
if (message.member!.roles.icon) msg.author.topRole.badgeURL = message.member!.roles.icon.iconURL()!;
if (message.content) msg.content = message.content;
- if (message.embeds.length > 0) msg.embeds = message.embeds.map(embed => {
- const obj: TranscriptEmbed = {};
- if (embed.title) obj.title = embed.title;
- if (embed.description) obj.description = embed.description;
- if (embed.fields.length > 0) obj.fields = embed.fields.map(field => {
- return {
- name: field.name,
- value: field.value,
- inline: field.inline ?? false
- }
+ if (message.embeds.length > 0)
+ msg.embeds = message.embeds.map((embed) => {
+ const obj: TranscriptEmbed = {};
+ if (embed.title) obj.title = embed.title;
+ if (embed.description) obj.description = embed.description;
+ if (embed.fields.length > 0)
+ obj.fields = embed.fields.map((field) => {
+ return {
+ name: field.name,
+ value: field.value,
+ inline: field.inline ?? false
+ };
+ });
+ if (embed.color) obj.color = embed.color;
+ if (embed.timestamp) obj.timestamp = embed.timestamp;
+ if (embed.footer)
+ obj.footer = {
+ text: embed.footer.text
+ };
+ if (embed.footer?.iconURL) obj.footer!.iconURL = embed.footer.iconURL;
+ if (embed.author)
+ obj.author = {
+ name: embed.author.name
+ };
+ if (embed.author?.iconURL) obj.author!.iconURL = embed.author.iconURL;
+ if (embed.author?.url) obj.author!.url = embed.author.url;
+ return obj;
});
- if (embed.color) obj.color = embed.color;
- if (embed.timestamp) obj.timestamp = embed.timestamp
- if (embed.footer) obj.footer = {
- text: embed.footer.text,
- };
- if (embed.footer?.iconURL) obj.footer!.iconURL = embed.footer.iconURL;
- if (embed.author) obj.author = {
- name: embed.author.name
- };
- if (embed.author?.iconURL) obj.author!.iconURL = embed.author.iconURL;
- if (embed.author?.url) obj.author!.url = embed.author.url;
- return obj;
- });
- if (message.components.length > 0) msg.components = message.components.map(component => component.components.map(child => {
- const obj: TranscriptComponent = {
- type: child.type
- }
- if (child.type === ComponentType.Button) {
- obj.style = child.style;
- obj.label = child.label ?? "";
- } else if (child.type > 2) {
- obj.placeholder = child.placeholder ?? "";
- }
- return obj
- }));
+ if (message.components.length > 0)
+ msg.components = message.components.map((component) =>
+ component.components.map((child) => {
+ const obj: TranscriptComponent = {
+ type: child.type
+ };
+ if (child.type === ComponentType.Button) {
+ obj.style = child.style;
+ obj.label = child.label ?? "";
+ } else if (child.type > 2) {
+ obj.placeholder = child.placeholder ?? "";
+ }
+ return obj;
+ })
+ );
if (message.editedTimestamp) msg.editedTimestamp = message.editedTimestamp;
msg.flags = message.flags.toArray();
- if (message.stickers.size > 0) msg.stickerURLs = message.stickers.map(sticker => sticker.url);
- if (message.reference) msg.referencedMessage = [message.reference.guildId ?? "", message.reference.channelId, message.reference.messageId ?? ""];
+ if (message.stickers.size > 0) msg.stickerURLs = message.stickers.map((sticker) => sticker.url);
+ if (message.reference)
+ msg.referencedMessage = [
+ message.reference.guildId ?? "",
+ message.reference.channelId,
+ message.reference.messageId ?? ""
+ ];
newOut.messages.push(msg);
});
return newOut;
@@ -407,10 +454,11 @@
if (message.referencedMessage) {
if (Array.isArray(message.referencedMessage)) {
out += `> [Crosspost From] ${message.referencedMessage[0]} in ${message.referencedMessage[1]} in ${message.referencedMessage[2]}\n`;
- }
- else out += `> [Reply To] ${message.referencedMessage}\n`;
+ } else out += `> [Reply To] ${message.referencedMessage}\n`;
}
- out += `${message.author.nickname ?? message.author.username}#${message.author.discriminator} (${message.author.id}) (${message.id})`;
+ out += `${message.author.nickname ?? message.author.username}#${message.author.discriminator} (${
+ message.author.id
+ }) (${message.id})`;
out += ` [${new Date(message.createdTimestamp).toISOString()}]`;
if (message.editedTimestamp) out += ` [Edited: ${new Date(message.editedTimestamp).toISOString()}]`;
out += "\n";
@@ -445,9 +493,9 @@
out += `[Attachment] ${attachment.filename} (${attachment.size} bytes) ${attachment.url}\n`;
}
}
- out += "\n\n"
+ out += "\n\n";
}
- return out
+ return out;
}
}
@@ -469,17 +517,20 @@
amount?: string | null
) {
// console.log("History create");
- await this.histories.insertOne({
- type: type,
- guild: guild,
- user: user.id,
- moderator: moderator ? moderator.id : null,
- reason: reason,
- occurredAt: new Date(),
- before: before ?? null,
- after: after ?? null,
- amount: amount ?? null
- }, collectionOptions);
+ await this.histories.insertOne(
+ {
+ type: type,
+ guild: guild,
+ user: user.id,
+ moderator: moderator ? moderator.id : null,
+ reason: reason,
+ occurredAt: new Date(),
+ before: before ?? null,
+ after: after ?? null,
+ amount: amount ?? null
+ },
+ collectionOptions
+ );
}
async read(guild: string, user: string, year: number) {
@@ -524,12 +575,18 @@
async write(hash: string, data: boolean, tags?: string[]) {
// console.log("ScanCache write");
- await this.scanCache.insertOne({ hash: hash, data: data, tags: tags ?? [], addedAt: new Date() }, collectionOptions);
+ await this.scanCache.insertOne(
+ { hash: hash, data: data, tags: tags ?? [], addedAt: new Date() },
+ collectionOptions
+ );
}
async cleanup() {
// console.log("ScanCache cleanup");
- await this.scanCache.deleteMany({ addedAt: { $lt: new Date(Date.now() - (1000 * 60 * 60 * 24 * 31)) }, hash: { $not$text: "http"} });
+ await this.scanCache.deleteMany({
+ addedAt: { $lt: new Date(Date.now() - 1000 * 60 * 60 * 24 * 31) },
+ hash: { $not$text: "http" }
+ });
}
}
@@ -559,7 +616,7 @@
cpu: number;
memory: number;
temperature: number;
- }
+ };
}
export class ModNotes {
@@ -588,8 +645,8 @@
export class Premium {
premium: Collection<PremiumSchema>;
- cache: Map<string, [boolean, string, number, boolean, Date]>; // Date indicates the time one hour after it was created
- cacheTimeout = 1000 * 60 * 60; // 1 hour
+ cache: Map<string, [boolean, string, number, boolean, Date]>; // Date indicates the time one hour after it was created
+ cacheTimeout = 1000 * 60 * 60; // 1 hour
constructor() {
this.premium = database.collection<PremiumSchema>("premium");
@@ -598,7 +655,7 @@
async updateUser(user: string, level: number) {
// console.log("Premium updateUser");
- if(!(await this.userExists(user))) await this.createUser(user, level);
+ if (!(await this.userExists(user))) await this.createUser(user, level);
await this.premium.updateOne({ user: user }, { $set: { level: level } }, { upsert: true });
}
@@ -618,25 +675,32 @@
const cached = this.cache.get(guild);
if (cached && cached[4].getTime() < Date.now()) return [cached[0], cached[1], cached[2], cached[3]];
const entries = await this.premium.find({}).toArray();
- const members = (await client.guilds.fetch(guild)).members.cache
- for(const {user} of entries) {
+ const members = (await client.guilds.fetch(guild)).members.cache;
+ for (const { user } of entries) {
const member = members.get(user);
- if(member) { //TODO: Notify user if they've given premium to a server that has since gotten premium via a mod.
+ if (member) {
+ //TODO: Notify user if they've given premium to a server that has since gotten premium via a mod.
const modPerms = //TODO: Create list in config for perms
- member.permissions.has("Administrator") ||
- member.permissions.has("ManageChannels") ||
- member.permissions.has("ManageRoles") ||
- member.permissions.has("ManageEmojisAndStickers") ||
- member.permissions.has("ManageWebhooks") ||
- member.permissions.has("ManageGuild") ||
- member.permissions.has("KickMembers") ||
- member.permissions.has("BanMembers") ||
- member.permissions.has("ManageEvents") ||
- member.permissions.has("ManageMessages") ||
- member.permissions.has("ManageThreads")
- const entry = entries.find(e => e.user === member.id);
- if(entry && (entry.level === 3) && modPerms) {
- this.cache.set(guild, [true, member.id, entry.level, true, new Date(Date.now() + this.cacheTimeout)]);
+ member.permissions.has("Administrator") ||
+ member.permissions.has("ManageChannels") ||
+ member.permissions.has("ManageRoles") ||
+ member.permissions.has("ManageEmojisAndStickers") ||
+ member.permissions.has("ManageWebhooks") ||
+ member.permissions.has("ManageGuild") ||
+ member.permissions.has("KickMembers") ||
+ member.permissions.has("BanMembers") ||
+ member.permissions.has("ManageEvents") ||
+ member.permissions.has("ManageMessages") ||
+ member.permissions.has("ManageThreads");
+ const entry = entries.find((e) => e.user === member.id);
+ if (entry && entry.level === 3 && modPerms) {
+ this.cache.set(guild, [
+ true,
+ member.id,
+ entry.level,
+ true,
+ new Date(Date.now() + this.cacheTimeout)
+ ]);
return [true, member.id, entry.level, true];
}
}
@@ -648,7 +712,13 @@
}
}
});
- this.cache.set(guild, [entry ? true : false, entry?.user ?? "", entry?.level ?? 0, false, new Date(Date.now() + this.cacheTimeout)]);
+ this.cache.set(guild, [
+ entry ? true : false,
+ entry?.user ?? "",
+ entry?.level ?? 0,
+ false,
+ new Date(Date.now() + this.cacheTimeout)
+ ]);
return entry ? [true, entry.user, entry.level, false] : null;
}
@@ -662,11 +732,11 @@
async checkAllPremium(member?: GuildMember) {
// console.log("Premium checkAllPremium");
const entries = await this.premium.find({}).toArray();
- if(member) {
- const entry = entries.find(e => e.user === member.id);
- if(entry) {
+ if (member) {
+ const entry = entries.find((e) => e.user === member.id);
+ if (entry) {
const expiresAt = entry.expiresAt;
- if(expiresAt) expiresAt < Date.now() ? await this.premium.deleteOne({user: member.id}) : null;
+ if (expiresAt) expiresAt < Date.now() ? await this.premium.deleteOne({ user: member.id }) : null;
}
const roles = member.roles;
let level = 0;
@@ -681,17 +751,20 @@
}
await this.updateUser(member.id, level);
if (level > 0) {
- await this.premium.updateOne({ user: member.id }, {$unset: { expiresAt: ""}})
+ await this.premium.updateOne({ user: member.id }, { $unset: { expiresAt: "" } });
} else {
- await this.premium.updateOne({ user: member.id }, {$set: { expiresAt: (Date.now() + (1000*60*60*24*3)) }})
+ await this.premium.updateOne(
+ { user: member.id },
+ { $set: { expiresAt: Date.now() + 1000 * 60 * 60 * 24 * 3 } }
+ );
}
} else {
- const members = await (await client.guilds.fetch('684492926528651336')).members.fetch();
- for(const {roles, id} of members.values()) {
- const entry = entries.find(e => e.user === id);
- if(entry) {
+ const members = await (await client.guilds.fetch("684492926528651336")).members.fetch();
+ for (const { roles, id } of members.values()) {
+ const entry = entries.find((e) => e.user === id);
+ if (entry) {
const expiresAt = entry.expiresAt;
- if(expiresAt) expiresAt < Date.now() ? await this.premium.deleteOne({user: id}) : null;
+ if (expiresAt) expiresAt < Date.now() ? await this.premium.deleteOne({ user: id }) : null;
}
let level: number = 0;
if (roles.cache.has("1066468879309750313")) {
@@ -705,9 +778,12 @@
}
await this.updateUser(id, level);
if (level > 0) {
- await this.premium.updateOne({ user: id }, {$unset: { expiresAt: ""}})
+ await this.premium.updateOne({ user: id }, { $unset: { expiresAt: "" } });
} else {
- await this.premium.updateOne({ user: id }, {$set: { expiresAt: (Date.now() + (1000*60*60*24*3)) }})
+ await this.premium.updateOne(
+ { user: id },
+ { $set: { expiresAt: Date.now() + 1000 * 60 * 60 * 24 * 3 } }
+ );
}
}
}
@@ -773,13 +849,13 @@
allowed: {
users: string[];
roles: string[];
- }
- }
+ };
+ };
};
autoPublish: {
enabled: boolean;
channels: string[];
- }
+ };
welcome: {
enabled: boolean;
role: string | null;
@@ -846,7 +922,7 @@
nick: {
text: string | null;
link: string | null;
- }
+ };
};
tracks: {
name: string;
diff --git a/src/utils/defaults.ts b/src/utils/defaults.ts
index 1331ce1..0d4c9e3 100644
--- a/src/utils/defaults.ts
+++ b/src/utils/defaults.ts
@@ -9,7 +9,7 @@
export const LinkWarningFooter = {
text: "The button below will take you to a website set by the server moderators. Do not enter any passwords unless it is from a trusted website.",
iconURL: "https://cdn.discordapp.com/emojis/952295894370369587.webp?size=128&quality=lossless"
-}
+};
class Embed {
embed: EmojiEmbed = new EmojiEmbed();
diff --git a/src/utils/dualCollector.ts b/src/utils/dualCollector.ts
index 0b05779..bf9b0c0 100644
--- a/src/utils/dualCollector.ts
+++ b/src/utils/dualCollector.ts
@@ -1,4 +1,13 @@
-import { ButtonInteraction, Client, User, Interaction, InteractionCollector, Message, MessageComponentInteraction, ModalSubmitInteraction } from "discord.js";
+import {
+ ButtonInteraction,
+ Client,
+ User,
+ Interaction,
+ InteractionCollector,
+ Message,
+ MessageComponentInteraction,
+ ModalSubmitInteraction
+} from "discord.js";
import client from "./client.js";
export default async function (
@@ -10,14 +19,15 @@
try {
out = await new Promise((resolve, _reject) => {
const mes = m
- .createMessageComponentCollector({
- filter: (m) => interactionFilter(m),
- time: 300000
- })
- .on("collect", (m) => {
+ .createMessageComponentCollector({
+ filter: (m) => interactionFilter(m),
+ time: 300000
+ })
+ .on("collect", (m) => {
resolve(m);
});
- const int = m.channel.createMessageCollector({
+ const int = m.channel
+ .createMessageCollector({
filter: (m) => messageFilter(m),
time: 300000
})
@@ -45,15 +55,15 @@
}
function defaultInteractionFilter(i: MessageComponentInteraction, user: User, m: Message) {
- return i.channel!.id === m.channel!.id && i.user.id === user.id
+ return i.channel!.id === m.channel!.id && i.user.id === user.id;
}
function defaultModalFilter(i: ModalSubmitInteraction, user: User, m: Message) {
- return i.channel!.id === m.channel!.id && i.user.id === user.id
+ return i.channel!.id === m.channel!.id && i.user.id === user.id;
}
-
export async function modalInteractionCollector(
- m: Message, user: User,
+ m: Message,
+ user: User,
modalFilter?: (i: Interaction) => boolean | Promise<boolean>,
interactionFilter?: (i: MessageComponentInteraction) => boolean | Promise<boolean>
): Promise<null | ButtonInteraction | ModalSubmitInteraction> {
@@ -62,7 +72,8 @@
out = await new Promise((resolve, _reject) => {
const int = m
.createMessageComponentCollector({
- filter: (i: MessageComponentInteraction) => (interactionFilter ? interactionFilter(i) : true) && defaultInteractionFilter(i, user, m),
+ filter: (i: MessageComponentInteraction) =>
+ (interactionFilter ? interactionFilter(i) : true) && defaultInteractionFilter(i, user, m),
time: 300000
})
.on("collect", async (i: ButtonInteraction) => {
@@ -72,7 +83,8 @@
resolve(i);
});
const mod = new InteractionCollector(client as Client, {
- filter: (i: Interaction) => (modalFilter ? modalFilter(i) : true) && i.isModalSubmit() && defaultModalFilter(i, user, m),
+ filter: (i: Interaction) =>
+ (modalFilter ? modalFilter(i) : true) && i.isModalSubmit() && defaultModalFilter(i, user, m),
time: 300000
}).on("collect", async (i: ModalSubmitInteraction) => {
int.stop();
diff --git a/src/utils/ellipsis.ts b/src/utils/ellipsis.ts
index 6ec5888..4ba1f72 100644
--- a/src/utils/ellipsis.ts
+++ b/src/utils/ellipsis.ts
@@ -1,4 +1,4 @@
export default (str: string, max: number): string => {
if (str.length <= max) return str;
return str.slice(0, max - 3) + "...";
-}
\ No newline at end of file
+};
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index f3b7a00..2ef5fb4 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -23,20 +23,31 @@
await job.remove();
});
this.agenda.define("uploadTranscript", async (job) => {
- const channelID: string | null = (await client.database.guilds.read(job.attrs.data.guild)).logging.logs.channel;
+ const channelID: string | null = (await client.database.guilds.read(job.attrs.data.guild)).logging.logs
+ .channel;
if (!channelID) return;
const channel = await client.channels.fetch(channelID);
- if(!channel || !(channel instanceof TextChannel)) return;
- const transcript = await client.database.transcripts.read(job.attrs.data.transcript, job.attrs.data.key, job.attrs.data.iv);
+ if (!channel || !(channel instanceof TextChannel)) return;
+ const transcript = await client.database.transcripts.read(
+ job.attrs.data.transcript,
+ job.attrs.data.key,
+ job.attrs.data.iv
+ );
await client.database.transcripts.delete(job.attrs.data.transcript);
const file = Buffer.from(JSON.stringify(transcript), "base64");
const fileName = `${job.attrs.data.transcript}.json`;
const m = await channel.send({ files: [{ attachment: file, name: fileName }] });
- await client.database.transcripts.upload({ channelID: channel.id, messageID: m.id, transcript: job.attrs.data.transcript})
+ await client.database.transcripts.upload({
+ channelID: channel.id,
+ messageID: m.id,
+ transcript: job.attrs.data.transcript
+ });
await job.remove();
});
this.agenda.define("deleteFile", async (job) => {
- fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), (e) => { client.emit("error", e as Error); });
+ fs.rm(path.resolve("dist/utils/temp", job.attrs.data.fileName), (e) => {
+ client.emit("error", e as Error);
+ });
await job.remove();
});
this.agenda.define("naturalUnmute", async (job) => {
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index a326fc5..542fc18 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -13,9 +13,13 @@
description = "";
_generateTitle() {
- if (this._emoji && !this._title) return getEmojiByName(this._emoji)
- if (this._emoji) { return `${getEmojiByName(this._emoji)} ${this._title}`; }
- if (this._title) { return this._title };
+ if (this._emoji && !this._title) return getEmojiByName(this._emoji);
+ if (this._emoji) {
+ return `${getEmojiByName(this._emoji)} ${this._title}`;
+ }
+ if (this._title) {
+ return this._title;
+ }
return "";
}
@@ -42,5 +46,4 @@
}
}
-
export default EmojiEmbed;
diff --git a/src/utils/getCommandDataByName.ts b/src/utils/getCommandDataByName.ts
index da3e54b..46f4362 100644
--- a/src/utils/getCommandDataByName.ts
+++ b/src/utils/getCommandDataByName.ts
@@ -1,22 +1,20 @@
import type Discord from "discord.js";
import client from "./client.js";
-
export const getCommandMentionByName = (name: string): string => {
- const split = name.replaceAll("/", " ").split(" ")
+ const split = name.replaceAll("/", " ").split(" ");
const commandName: string = split[0]!;
const filterCommand = (command: Discord.ApplicationCommand) => command.name === commandName;
- const command = client.fetchedCommands.filter(c => filterCommand(c))
+ const command = client.fetchedCommands.filter((c) => filterCommand(c));
if (command.size === 0) return `\`/${name.replaceAll("/", " ")}\``;
const commandID = command.first()!.id;
return `</${split.join(" ")}:${commandID}>`;
-}
+};
-export const getCommandByName = (name: string): {name: string, description: string, mention: string} => {
-
- const split = name.replaceAll(" ", "/")
+export const getCommandByName = (name: string): { name: string; description: string; mention: string } => {
+ const split = name.replaceAll(" ", "/");
const command = client.commands["commands/" + split]!;
// console.log(command)
const mention = getCommandMentionByName(name);
@@ -24,5 +22,5 @@
name: command[1].name,
description: command[1].description,
mention: mention
- }
-}
\ No newline at end of file
+ };
+};
diff --git a/src/utils/getEmojiByName.ts b/src/utils/getEmojiByName.ts
index 9df17a4..99d1215 100644
--- a/src/utils/getEmojiByName.ts
+++ b/src/utils/getEmojiByName.ts
@@ -1,5 +1,5 @@
import emojis from "../config/emojis.json" assert { type: "json" };
-import lodash from 'lodash';
+import lodash from "lodash";
const isArray = lodash.isArray;
interface EmojisIndex {
diff --git a/src/utils/listToAndMore.ts b/src/utils/listToAndMore.ts
index 791ce40..047cbc9 100644
--- a/src/utils/listToAndMore.ts
+++ b/src/utils/listToAndMore.ts
@@ -1,7 +1,7 @@
export default (list: string[], max: number) => {
// PineappleFan, Coded, Mini (and 10 more)
- if(list.length > max) {
+ if (list.length > max) {
return list.slice(0, max).join(", ") + ` (and ${list.length - max} more)`;
}
return list.join(", ");
-}
\ No newline at end of file
+};
diff --git a/src/utils/log.ts b/src/utils/log.ts
index bb95eda..0601863 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -20,18 +20,20 @@
list: any;
hidden: {
guild: string;
- },
+ };
separate?: {
start?: string;
end?: string;
- }
+ };
}
async function isLogging(guild: string, type: string): Promise<boolean> {
const config = await client.database.guilds.read(guild);
if (!config.logging.logs.enabled) return false;
if (!config.logging.logs.channel) return false;
- if (!toHexArray(config.logging.logs.toLog).includes(type)) { return false; }
+ if (!toHexArray(config.logging.logs.toLog).includes(type)) {
+ return false;
+ }
return true;
}
@@ -52,16 +54,21 @@
const delta = num2 - num1;
return `${num1} -> ${num2} (${delta > 0 ? "+" : ""}${delta})`;
},
- entry(value: string | number | boolean | null | (string | boolean)[], displayValue: string): { value: string | boolean | null | (string | boolean | number)[]; displayValue: string } {
+ entry(
+ value: string | number | boolean | null | (string | boolean)[],
+ displayValue: string
+ ): { value: string | boolean | null | (string | boolean | number)[]; displayValue: string } {
if (typeof value === "number") value = value.toString();
return { value: value, displayValue: displayValue };
},
renderChannel(channel: Discord.GuildChannel | Discord.ThreadChannel | string) {
- if (typeof channel === "string") channel = client.channels.cache.get(channel) as Discord.GuildChannel | Discord.ThreadChannel;
+ if (typeof channel === "string")
+ channel = client.channels.cache.get(channel) as Discord.GuildChannel | Discord.ThreadChannel;
return `${channel.name} [<#${channel.id}>]`;
},
renderRole(role: Discord.Role | string, guild?: Discord.Guild | string) {
- if (typeof role === "string") role = (typeof guild === "string" ? client.guilds.cache.get(guild) : guild)!.roles.cache.get(role)!;
+ if (typeof role === "string")
+ role = (typeof guild === "string" ? client.guilds.cache.get(guild) : guild)!.roles.cache.get(role)!;
return `${role.name} [<@&${role.id}>]`;
},
renderEmoji(emoji: Discord.GuildEmoji) {
@@ -72,16 +79,20 @@
yellow: 0xf2d478,
green: 0x68d49e
},
- async getAuditLog(guild: Discord.Guild, event: Discord.GuildAuditLogsResolvable, delay?: number): Promise<Discord.GuildAuditLogsEntry[]> {
+ async getAuditLog(
+ guild: Discord.Guild,
+ event: Discord.GuildAuditLogsResolvable,
+ delay?: number
+ ): Promise<Discord.GuildAuditLogsEntry[]> {
await wait(delay ?? 250);
- const auditLog = (await guild.fetchAuditLogs({ type: event })).entries.map(m => m)
+ const auditLog = (await guild.fetchAuditLogs({ type: event })).entries.map((m) => m);
return auditLog as Discord.GuildAuditLogsEntry[];
},
async log(log: LoggerOptions): Promise<void> {
- if (!await isLogging(log.hidden.guild, log.meta.calculateType)) return;
- console.log(log.hidden.guild)
+ if (!(await isLogging(log.hidden.guild, log.meta.calculateType))) return;
+ console.log(log.hidden.guild);
const config = await client.database.guilds.read(log.hidden.guild);
- console.log(config.logging.logs.channel)
+ console.log(config.logging.logs.channel);
if (config.logging.logs.channel) {
const channel = (await client.channels.fetch(config.logging.logs.channel)) as Discord.TextChannel | null;
@@ -102,8 +113,8 @@
.setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
.setDescription(
(log.separate.start ? log.separate.start + "\n" : "") +
- generateKeyValueList(description) +
- (log.separate.end ? "\n" + log.separate.end : "")
+ generateKeyValueList(description) +
+ (log.separate.end ? "\n" + log.separate.end : "")
)
.setTimestamp(log.meta.timestamp)
.setColor(log.meta.color);
diff --git a/src/utils/memory.ts b/src/utils/memory.ts
index 60a6535..e43f82c 100644
--- a/src/utils/memory.ts
+++ b/src/utils/memory.ts
@@ -22,7 +22,7 @@
}
}
}, 1000 * 60 * 30);
- };
+ }
async readGuildInfo(guild: string): Promise<GuildData> {
if (!this.memory.has(guild)) {
@@ -37,7 +37,7 @@
});
}
return this.memory.get(guild)!;
- };
+ }
async forceUpdate(guild: string) {
if (this.memory.has(guild)) this.memory.delete(guild);
diff --git a/src/utils/performanceTesting/record.ts b/src/utils/performanceTesting/record.ts
index 71883c5..89f3ead 100644
--- a/src/utils/performanceTesting/record.ts
+++ b/src/utils/performanceTesting/record.ts
@@ -1,14 +1,13 @@
import client from "../client.js";
-import * as CP from 'child_process';
-import * as process from 'process';
+import * as CP from "child_process";
+import * as process from "process";
import systeminformation from "systeminformation";
import config from "../../config/main.js";
import singleNotify from "../singleNotify.js";
-
const discordPing = () => {
return client.ws.ping;
-}
+};
const databaseReadTime = async () => {
const guild = await client.guilds.fetch(config.managementGuildID);
@@ -18,15 +17,15 @@
client.database.history.read(guild.id, user, currentYear - 1);
const end = Date.now();
return end - start;
-}
+};
const resources = async () => {
return {
memory: process.memoryUsage().rss / 1024 / 1024,
cpu: parseFloat(CP.execSync(`ps -p ${process.pid} -o %cpu=`).toString().trim()),
temperature: (await systeminformation.cpuTemperature()).main
- }
-}
+ };
+};
const record = async () => {
if (config.enableDevelopment) return;
@@ -39,18 +38,22 @@
singleNotify(
"performanceTest",
config.developmentGuildID,
- `Discord ping time: \`${results.discord}ms\`\nDatabase read time: \`${results.databaseRead}ms\`\nCPU usage: \`${results.resources.cpu}%\`\nMemory usage: \`${Math.round(results.resources.memory)}MB\`\nCPU temperature: \`${results.resources.temperature}°C\``,
+ `Discord ping time: \`${results.discord}ms\`\nDatabase read time: \`${
+ results.databaseRead
+ }ms\`\nCPU usage: \`${results.resources.cpu}%\`\nMemory usage: \`${Math.round(
+ results.resources.memory
+ )}MB\`\nCPU temperature: \`${results.resources.temperature}°C\``,
"Critical",
config.owners
- )
+ );
} else {
- singleNotify("performanceTest", config.developmentGuildID, true)
+ singleNotify("performanceTest", config.developmentGuildID, true);
}
- client.database.performanceTest.record(results)
+ client.database.performanceTest.record(results);
setTimeout(async () => {
await record();
}, 60 * 1000);
-}
+};
export { record };
diff --git a/src/utils/search.ts b/src/utils/search.ts
index 310dbf8..5fce74f 100644
--- a/src/utils/search.ts
+++ b/src/utils/search.ts
@@ -2,17 +2,14 @@
function getResults(typed: string, options: string[]): string[] {
options = options.filter((option) => option.length <= 100); // thanks discord. 6000 character limit on slash command inputs but only 100 for autocomplete.
- if (!typed)
- return options
- .slice(0, 25)
- .sort()
+ if (!typed) return options.slice(0, 25).sort();
// @ts-expect-error
const fuse = new Fuse(options, {
useExtendedSearch: true,
findAllMatches: true,
- minMatchCharLength: typed.length > 3 ? 3 : typed.length,
+ minMatchCharLength: typed.length > 3 ? 3 : typed.length
}).search(typed);
- return fuse.slice(0, 25).map((option: {item: string }) => option.item );
+ return fuse.slice(0, 25).map((option: { item: string }) => option.item);
}
-export { getResults }
\ No newline at end of file
+export { getResults };
diff --git a/src/utils/singleNotify.ts b/src/utils/singleNotify.ts
index 6bf63e1..08c7af5 100644
--- a/src/utils/singleNotify.ts
+++ b/src/utils/singleNotify.ts
@@ -33,13 +33,15 @@
if (!channel) return;
if (!channel.isTextBased()) return;
const textChannel = channel as TextChannel | ThreadChannel | NewsChannel;
- let messageData = {embeds: [
- new EmojiEmbed()
- .setTitle(`${severity} notification`)
- .setDescription(message)
- .setStatus(severities.get(severity))
- .setEmoji("CONTROL.BLOCKCROSS")
- ]}
+ let messageData = {
+ embeds: [
+ new EmojiEmbed()
+ .setTitle(`${severity} notification`)
+ .setDescription(message)
+ .setStatus(severities.get(severity))
+ .setEmoji("CONTROL.BLOCKCROSS")
+ ]
+ };
if (pings) {
messageData = Object.assign(messageData, {
content: pings.map((ping) => `<@${ping}>`).join(" ")