fixing eslint
diff --git a/src/commands/help.ts b/src/commands/help.ts
index b6115f9..90ef133 100644
--- a/src/commands/help.ts
+++ b/src/commands/help.ts
@@ -100,7 +100,7 @@
nameLocalized?: string;
descriptionLocalized?: string;
})[] = [];
- //o ptions
+ //options
if(currentPath[1] !== "" && currentPath[1] !== "none" && currentPath[2] !== "" && currentPath[2] !== "none") {
const Op = current.options.find(option => option.name === currentPath[1])! as ApplicationCommandSubGroup
const Op2 = Op.options!.find(option => option.name === currentPath[2])!
@@ -114,7 +114,7 @@
options = Op.options ?? []
}
} else {
- options = current.options.filter(option => option.type !== ApplicationCommandOptionType.SubcommandGroup && option.type !== ApplicationCommandOptionType.Subcommand) || [];
+ options = current.options.filter(option => (option.type !== ApplicationCommandOptionType.SubcommandGroup) && (option.type !== ApplicationCommandOptionType.Subcommand));
}
for(const option of options) {
optionString += `> ${option.name} (${ApplicationCommandOptionType[option.type]})- ${option.description}\n`
@@ -141,7 +141,7 @@
...subcommandGroups.map((option) => new StringSelectMenuOptionBuilder().setLabel(capitalize(option.name)).setValue(option.name).setDefault(currentPath[1] === option.name))
)
if(subcommandGroupRow.components[0]!.options.find((option) => option.data.default && option.data.value !== "none")) {
- const subsubcommands = (subcommandGroups.find((option) => option.name === currentPath[1])! as ApplicationCommandSubGroup).options?.filter((option) => option.type === ApplicationCommandOptionType.Subcommand) ?? [];
+ const subsubcommands = (subcommandGroups.find((option) => option.name === currentPath[1])! as ApplicationCommandSubGroup).options ?? [];
subcommandRow.components[0]!
.addOptions(
new StringSelectMenuOptionBuilder().setLabel("Select a subcommand").setValue("none").setDefault(currentPath[2] === "none"),
diff --git a/src/commands/nucleus/premium.ts b/src/commands/nucleus/premium.ts
index e0d8d8d..354c303 100644
--- a/src/commands/nucleus/premium.ts
+++ b/src/commands/nucleus/premium.ts
@@ -1,4 +1,4 @@
-import { ActionRowBuilder, ButtonBuilder, ButtonStyle, CommandInteraction } from "discord.js";
+import { ActionRowBuilder, ButtonBuilder, ButtonInteraction, ButtonStyle, CommandInteraction } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -28,7 +28,7 @@
const dbMember = await client.database.premium.fetchUser(interaction.user.id)
let premium = `You do not have premium! You can't activate premium on any servers.`;
let count = 0;
- const {level, appliesTo} = dbMember || {level: 0, appliesTo: []}
+ const {level, appliesTo} = dbMember ?? {level: 0, appliesTo: []}
if (level === 99) {
premium = `You have Infinite Premium! You have been gifted this by the developers as a thank you. You can give premium to any and all servers you are in.`;
count = 200;
@@ -48,71 +48,65 @@
premiumGuild = `\n\n**This server has premium!**`
}
- let closed = false;
- do {
+ interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setTitle("Premium")
+ .setDescription(
+ premium + firstDescription + premiumGuild
+ )
+ .setEmoji("NUCLEUS.LOGO")
+ .setStatus("Danger")
+ ],
+ components: [
+ new ActionRowBuilder<ButtonBuilder>()
+ .addComponents(
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Primary)
+ .setLabel("Activate Premium here")
+ .setCustomId("premiumActivate")
+ .setDisabled(count <= 0 && hasPremium)
+ )
+ ]
+ });
+
+ const filter = (i: ButtonInteraction) => i.customId === "premiumActivate" && i.user.id === interaction.user.id;
+ let i;
+ try {
+ i = await interaction.channel!.awaitMessageComponent<2>({ filter, time: 60000 });
+ } catch (e) {
+ return;
+ }
+ i.deferUpdate();
+ const guild = i.guild!;
+ if (count - appliesTo.length <= 0) {
interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium")
.setDescription(
- premium + firstDescription + premiumGuild
+ `You have already activated premium on the maximum amount of servers!` + firstDescription
+ )
+ .setEmoji("NUCLEUS.PREMIUMACTIVATE")
+ .setStatus("Danger")
+ ],
+ components: []
+ });
+ } else {
+ client.database.premium.addPremium(interaction.user.id, guild.id);
+ interaction.editReply({
+ embeds: [
+ new EmojiEmbed()
+ .setTitle("Premium")
+ .setDescription(
+ `You have activated premium on this server!` + firstDescription
)
.setEmoji("NUCLEUS.LOGO")
.setStatus("Danger")
],
- components: [
- new ActionRowBuilder<ButtonBuilder>()
- .addComponents(
- new ButtonBuilder()
- .setStyle(ButtonStyle.Primary)
- .setLabel("Activate Premium here")
- .setCustomId("premiumActivate")
- .setDisabled(count <= 0 && hasPremium)
- )
- ]
+ components: []
});
-
- const filter = (i: any) => i.customId === "premiumActivate" && i.user.id === interaction.user.id;
- let i;
- try {
- i = await interaction.channel!.awaitMessageComponent({ filter, time: 60000 });
- } catch (e) {
- return;
- }
- i.deferUpdate();
- const guild = i.guild!;
- if (count - appliesTo.length <= 0) {
- interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("Premium")
- .setDescription(
- `You have already activated premium on the maximum amount of servers!` + firstDescription
- )
- .setEmoji("NUCLEUS.PREMIUMACTIVATE")
- .setStatus("Danger")
- ],
- components: []
- });
- closed = true;
- } else {
- client.database.premium.addPremium(interaction.user.id, guild.id);
- interaction.editReply({
- embeds: [
- new EmojiEmbed()
- .setTitle("Premium")
- .setDescription(
- `You have activated premium on this server!` + firstDescription
- )
- .setEmoji("NUCLEUS.LOGO")
- .setStatus("Danger")
- ],
- components: []
- });
- closed = true;
- }
-
- } while (!closed);
+ }
};
export { command };
diff --git a/src/commands/server/buttons.ts b/src/commands/server/buttons.ts
index bc90983..61db825 100644
--- a/src/commands/server/buttons.ts
+++ b/src/commands/server/buttons.ts
@@ -44,7 +44,7 @@
});
let closed = false;
- let data: Data = {
+ const data: Data = {
buttons: [],
title: null,
description: null,
@@ -201,9 +201,9 @@
}
case "send": {
await i.deferUpdate();
- let channel = interaction.guild!.channels.cache.get(data.channel!) as Discord.TextChannel;
- let components = new ActionRowBuilder<ButtonBuilder>();
- for(let button of data.buttons) {
+ const channel = interaction.guild!.channels.cache.get(data.channel!) as Discord.TextChannel;
+ const components = new ActionRowBuilder<ButtonBuilder>();
+ for(const button of data.buttons) {
components.addComponents(
new ButtonBuilder()
.setCustomId(button)
@@ -211,9 +211,9 @@
.setStyle(ButtonStyle.Primary)
);
}
- let messageData: MessageCreateOptions = {components: [components]}
+ const messageData: MessageCreateOptions = {components: [components]}
if (data.title || data.description) {
- let e = new EmojiEmbed()
+ const e = new EmojiEmbed()
if(data.title) e.setTitle(data.title);
if(data.description) e.setDescription(data.description);
if(data.color) e.setColor(data.color);
@@ -224,7 +224,7 @@
}
}
} else if(i.isStringSelectMenu()) {
- try {await i.deferUpdate();} catch (err) {}
+ try {await i.deferUpdate();} catch (err) {console.log(err)}
switch(i.customId) {
case "color": {
data.color = colors[i.values[0]!]!;
diff --git a/src/commands/settings/automod.ts b/src/commands/settings/automod.ts
index f10cf67..87b1844 100644
--- a/src/commands/settings/automod.ts
+++ b/src/commands/settings/automod.ts
@@ -646,9 +646,9 @@
return current
}
-const cleanMenu = async (interaction: StringSelectMenuInteraction, m: Message, current: {
- channels: string[],
- allowed: {
+const cleanMenu = async (interaction: StringSelectMenuInteraction, m: Message, current?: {
+ channels?: string[],
+ allowed?: {
roles: string[],
user: string[]
}
@@ -729,12 +729,12 @@
} else {
switch (i.customId) {
case "toAdd": {
- let channelEmbed = new EmojiEmbed()
+ const channelEmbed = new EmojiEmbed()
.setTitle("Clean Settings")
.setDescription(`Editing <#${i.values[0]}>`)
.setEmoji("GUILD.SETTINGS.GREEN")
.setStatus("Success")
- let channelButtons = new ActionRowBuilder<ButtonBuilder>()
+ const channelButtons = new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setCustomId("back")
@@ -788,7 +788,13 @@
} while(!closed);
- return current;
+ return current as {
+ channels: string[],
+ allowed: {
+ roles: string[],
+ user: string[]
+ }
+ };
}
diff --git a/src/commands/settings/autopublish.ts b/src/commands/settings/autopublish.ts
index c4b9b56..f2c367f 100644
--- a/src/commands/settings/autopublish.ts
+++ b/src/commands/settings/autopublish.ts
@@ -58,7 +58,7 @@
}) as Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
} catch (e) {
closed = true;
- break;
+ continue;
}
if(i.isButton()) {
@@ -87,7 +87,7 @@
export const check = (interaction: CommandInteraction, _partial: boolean = false) => {
const member = interaction.member as Discord.GuildMember;
- const me = interaction.guild!.members.me as Discord.GuildMember;
+ const me = interaction.guild!.members.me!;
if (!member.permissions.has("ManageMessages"))
return "You must have the *Manage Messages* permission to use this command";
if (_partial) return true;
diff --git a/src/commands/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 545e3ff..a3b24ff 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -18,7 +18,7 @@
fetchReply: true
})
- if(!client.database.premium.hasPremium(interaction.guild!.id)) return interaction.editReply({
+ if(!await client.database.premium.hasPremium(interaction.guild!.id)) return interaction.editReply({
embeds: [
new EmojiEmbed()
.setTitle("Premium Required")
@@ -77,7 +77,7 @@
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;
} catch (e) {
closed = true;
- break;
+ continue;
}
await i.deferUpdate();
if(i.isButton()) {
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index a1f24fa..eeef8fb 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -104,7 +104,7 @@
`**Channel:** ${data.channel ? `<#${data.channel}>` : "None"}\n`
)
- let components: ActionRowBuilder<ButtonBuilder | ChannelSelectMenuBuilder | StringSelectMenuBuilder>[] = [channelMenu, buttons];
+ const components: ActionRowBuilder<ButtonBuilder | ChannelSelectMenuBuilder | StringSelectMenuBuilder>[] = [channelMenu, buttons];
if(show) components.push(toLogMenu);
await interaction.editReply({
@@ -120,7 +120,7 @@
}) as ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
} catch (e) {
closed = true;
- break;
+ continue;
}
await i.deferUpdate();
@@ -147,7 +147,7 @@
}
}
} else if(i.isStringSelectMenu()) {
- let hex = toHexInteger(i.values);
+ const hex = toHexInteger(i.values);
data.toLog = hex;
} else if(i.isChannelSelectMenu()) {
data.channel = i.values[0]!;
diff --git a/src/commands/settings/logs/warnings.ts b/src/commands/settings/logs/warnings.ts
index 6e5482c..25f9064 100644
--- a/src/commands/settings/logs/warnings.ts
+++ b/src/commands/settings/logs/warnings.ts
@@ -66,7 +66,7 @@
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;
} catch (e) {
closed = true;
- break;
+ continue;
}
await i.deferUpdate();
if(i.isButton()) {
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index af74475..2e046bf 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -154,7 +154,7 @@
.setCustomId("maxTickets")
.setPlaceholder("Enter a number")
.setRequired(false)
- .setValue(ticketData.maxTickets.toString() ?? "")
+ .setValue(ticketData.maxTickets.toString())
.setMinLength(1)
.setMaxLength(3)
.setStyle(TextInputStyle.Short)
@@ -187,7 +187,7 @@
}
if (!out || out.isButton()) continue;
out = out as ModalSubmitInteraction;
- let toAdd = out.fields.getTextInputValue("maxTickets");
+ const toAdd = out.fields.getTextInputValue("maxTickets");
if(isNaN(parseInt(toAdd))) {
errorMessage = "You entered an invalid number - No changes were made";
break;
@@ -394,11 +394,10 @@
toAdd = toAdd.substring(0, 80);
try {
if(!data.customTypes) data.customTypes = [];
- data.customTypes?.push(toAdd);
+ data.customTypes.push(toAdd);
} catch {
continue;
}
- data.customTypes = data.customTypes ?? [];
if (!data.customTypes.includes(toAdd)) {
data.customTypes.push(toAdd);
}
diff --git a/src/commands/settings/tracks.ts b/src/commands/settings/tracks.ts
index 8d2d59d..d9d485d 100644
--- a/src/commands/settings/tracks.ts
+++ b/src/commands/settings/tracks.ts
@@ -217,7 +217,7 @@
)
.setStatus("Success")
- let comps: ActionRowBuilder<RoleSelectMenuBuilder | ButtonBuilder | StringSelectMenuBuilder>[] = [roleSelect, buttons];
+ const comps: ActionRowBuilder<RoleSelectMenuBuilder | ButtonBuilder | StringSelectMenuBuilder>[] = [roleSelect, buttons];
if(current.track.length >= 1) comps.splice(1, 0, selectMenu);
interaction.editReply({embeds: [embed], components: comps});
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index ae55fc0..7584624 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -215,7 +215,7 @@
out = null;
}
if(!out) break;
- data.message = out.fields.getTextInputValue("message") ?? null;
+ data.message = out.fields.getTextInputValue("message");
break;
}
case "save": {
diff --git a/src/commands/tags/edit.ts b/src/commands/tags/edit.ts
index a80869e..7e297c8 100644
--- a/src/commands/tags/edit.ts
+++ b/src/commands/tags/edit.ts
@@ -19,9 +19,9 @@
const callback = async (interaction: CommandInteraction): Promise<unknown> => {
if (!interaction.guild) return;
- const name = interaction.options.get("name")?.value as string;
- const value = interaction.options.get("value")?.value as string ?? "";
- const newname = interaction.options.get("newname")?.value as string ?? "";
+ const name = (interaction.options.get("name")?.value ?? "") as string;
+ const value = (interaction.options.get("value")?.value ?? "") as string;
+ const newname = (interaction.options.get("newname")?.value ?? "") as string;
if (!newname && !value)
return await interaction.reply({
embeds: [
diff --git a/src/commands/user/role.ts b/src/commands/user/role.ts
index 5aa8782..41820ac 100644
--- a/src/commands/user/role.ts
+++ b/src/commands/user/role.ts
@@ -27,12 +27,12 @@
let member = interaction.options.getMember("user") as GuildMember | null;
if(!member) {
- let memberEmbed = new EmojiEmbed()
+ const memberEmbed = new EmojiEmbed()
.setTitle("Role")
.setDescription(`Please choose a member to edit the roles of.`)
.setEmoji("GUILD.ROLES.CREATE")
.setStatus("Success");
- let memberChooser = new ActionRowBuilder<UserSelectMenuBuilder>().addComponents(
+ const memberChooser = new ActionRowBuilder<UserSelectMenuBuilder>().addComponents(
new UserSelectMenuBuilder()
.setCustomId("memberChooser")
.setPlaceholder("Select a member")
@@ -48,7 +48,6 @@
return;
}
- if(!i) return;
memberEmbed.setDescription(`Editing roles for ${renderUser(i.values[0]!)}`);
await i.deferUpdate();
await interaction.editReply({ embeds: LoadingEmbed, components: [] })
@@ -67,14 +66,17 @@
);
do {
+
+ const removing = rolesToChange.filter((r) => member!.roles.cache.has(r)).map((r) => canEdit(interaction.guild?.roles.cache.get(r)!, interaction.member as GuildMember, interaction.guild?.members.me!)[0])
+ const adding = rolesToChange.filter((r) => !member!.roles.cache.has(r)).map((r) => canEdit(interaction.guild?.roles.cache.get(r)!, interaction.member as GuildMember, interaction.guild?.members.me!)[0])
const embed = new EmojiEmbed()
.setTitle("Role")
.setDescription(
`${getEmojiByName("ICONS.EDIT")} Editing roles for <@${member.id}>\n\n` +
`Adding:\n` +
- `${listToAndMore(rolesToChange.filter((r) => !member!.roles.cache.has(r)).map((r) => canEdit(interaction.guild?.roles.cache.get(r)!, interaction.member as GuildMember, interaction.guild?.members.me!)[0]) || ["None"], 5)}\n` +
+ `${listToAndMore(adding.length > 0 ? adding : ["None"], 5)}\n` +
`Removing:\n` +
- `${listToAndMore(rolesToChange.filter((r) => member!.roles.cache.has(r)).map((r) => canEdit(interaction.guild?.roles.cache.get(r)!, interaction.member as GuildMember, interaction.guild?.members.me!)[0]) || ["None"], 5)}\n`
+ `${listToAndMore(removing.length > 0 ? removing : ["None"], 5)}\n`
)
.setEmoji("GUILD.ROLES.CREATE")
.setStatus("Success");
@@ -99,18 +101,18 @@
try {
i = await m.awaitMessageComponent({ filter: (i) => i.user.id === interaction.user.id, time: 300000 }) as RoleSelectMenuInteraction | ButtonInteraction;
} catch (e) {
- return;
+ closed = true;
+ continue;
}
- if(!i) return;
i.deferUpdate();
if(i.isButton()) {
switch(i.customId) {
- case "roleSave":
+ case "roleSave": {
const roles = rolesToChange.map((r) => interaction.guild?.roles.cache.get(r)!);
await interaction.editReply({ embeds: LoadingEmbed, components: [] });
- let rolesToAdd: Role[] = [];
- let rolesToRemove: Role[] = [];
+ const rolesToAdd: Role[] = [];
+ const rolesToRemove: Role[] = [];
for(const role of roles) {
if(!canEdit(role, interaction.member as GuildMember, interaction.guild?.members.me!)[1]) continue;
if(member.roles.cache.has(role.id)) {
@@ -123,10 +125,12 @@
await member.roles.remove(rolesToRemove);
rolesToChange = [];
break;
- case "roleDiscard":
+ }
+ case "roleDiscard": {
rolesToChange = [];
await interaction.editReply({ embeds: LoadingEmbed, components: [] });
break;
+ }
}
} else {
rolesToChange = i.values;
diff --git a/src/events/guildMemberUpdate.ts b/src/events/guildMemberUpdate.ts
index 412ac96..b674060 100644
--- a/src/events/guildMemberUpdate.ts
+++ b/src/events/guildMemberUpdate.ts
@@ -1,60 +1,76 @@
import { AuditLogEvent, GuildAuditLogsEntry, GuildMember } from "discord.js";
import type { NucleusClient } from "../utils/client.js";
import type { LoggerOptions } from "../utils/log.js";
+import { generalException } from "../utils/createTemporaryStorage.js";
export const event = "guildMemberUpdate";
export async function callback(client: NucleusClient, before: GuildMember, after: GuildMember) {
const { log, NucleusColors, entry, renderUser, renderDelta, getAuditLog } = client.logger;
+ if(!before.roles.cache.equals(after.roles.cache)) {
+ const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberRoleUpdate))
+ .filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
+ if (!auditLog) return;
+ if (client.noLog.includes(`${after.guild.id}${after.id}${auditLog.id}`)) return;
+ generalException(`${after.guild.id}${after.id}${auditLog.id}`);
+ if (auditLog.executor!.id !== client.user!.id) {
+ const rolesAdded = after.roles.cache.filter(role => !before.roles.cache.has(role.id));
+ const rolesRemoved = before.roles.cache.filter(role => !after.roles.cache.has(role.id));
+ let displayName = "Roles Removed";
+ let color = NucleusColors.red;
+ let emoji = "GUILD.ROLES.DELETE";
+ if(rolesAdded.size > 0 && rolesRemoved.size > 0) {displayName = "Roles Changed"; color = NucleusColors.yellow; emoji = "GUILD.ROLES.EDIT";}
+ else if(rolesAdded.size > 0) {displayName = "Roles Added"; color = NucleusColors.green; emoji = "GUILD.ROLES.CREATE";}
+ const removedEntry = rolesRemoved.map(role => role.id);
+ const addedEntry = rolesAdded.map(role => role.id);
+
+ let list = {
+ memberId: entry(after.id, `\`${after.id}\``),
+ name: entry(after.user.id, renderUser(after.user)),
+ };
+
+ if (rolesAdded.size > 0) {
+ list = Object.assign(list, {rolesAdded: entry(addedEntry, addedEntry.map(id => `<@&${id}>`).join(", "))});
+ }
+ if (rolesRemoved.size > 0) {
+ list = Object.assign(list, {rolesRemoved: entry(removedEntry, removedEntry.map(id => `<@&${id}>`).join(", "))});
+ }
+
+ list = Object.assign(list, {
+ changed: entry(Date.now(), renderDelta(Date.now())),
+ changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
+ });
+
+ let data: LoggerOptions = {
+ meta: {
+ type: "memberUpdate",
+ displayName: displayName,
+ calculateType: "guildMemberUpdate",
+ color: color,
+ emoji: emoji,
+ timestamp: Date.now()
+ },
+ list: {},
+ hidden: {
+ guild: after.guild.id
+ }
+ };
+
+ if(rolesAdded.size > 0) {
+ list = Object.assign(list, {rolesAdded: entry(addedEntry, addedEntry.map(id => `<@&${id}>`).join(", "))});
+ }
+ if(rolesRemoved.size > 0) {
+ list = Object.assign(list, {rolesRemoved: entry(removedEntry, removedEntry.map(id => `<@&${id}>`).join(", "))});
+ }
+ data = Object.assign(data, {list: list});
+ log(data);
+ }
+ }
const auditLog = (await getAuditLog(after.guild, AuditLogEvent.MemberUpdate))
.filter((entry: GuildAuditLogsEntry) => (entry.target as GuildMember)!.id === after.id)[0];
if (!auditLog) return;
if (auditLog.executor!.id === client.user!.id) return;
- if(!before.roles.cache.equals(after.roles.cache)) {
- let rolesAdded = after.roles.cache.filter(role => !before.roles.cache.has(role.id));
- let rolesRemoved = before.roles.cache.filter(role => !after.roles.cache.has(role.id));
- let displayName = "Roles Removed";
- let color = NucleusColors.red;
- let emoji = "GUILD.ROLES.DELETE";
- if(rolesAdded.size > 0 && rolesRemoved.size > 0) {displayName = "Roles Changed"; color = NucleusColors.yellow; emoji = "GUILD.ROLES.EDIT";}
- else if(rolesAdded.size > 0) {displayName = "Roles Added"; color = NucleusColors.green; emoji = "GUILD.ROLES.CREATE";}
- let removedEntry = rolesRemoved.map(role => role.id);
- let addedEntry = rolesAdded.map(role => role.id);
-
- let list = {
- memberId: entry(after.id, `\`${after.id}\``),
- name: entry(after.user.id, renderUser(after.user)),
- changed: entry(Date.now(), renderDelta(Date.now())),
- changedBy: entry(auditLog.executor!.id, renderUser(auditLog.executor!))
- };
-
- let data: LoggerOptions = {
- meta: {
- type: "memberUpdate",
- displayName: displayName,
- calculateType: "guildMemberUpdate",
- color: color,
- emoji: emoji,
- timestamp: Date.now()
- },
- list: {
-
- },
- hidden: {
- guild: after.guild.id
- }
- };
-
- if(rolesAdded.size > 0) {
- list = Object.assign(list, {rolesAdded: entry(addedEntry, addedEntry.map(id => `<@&${id}>`).join(", "))});
- }
- if(rolesRemoved.size > 0) {
- list = Object.assign(list, {rolesRemoved: entry(removedEntry, removedEntry.map(id => `<@&${id}>`).join(", "))});
- }
- data = Object.assign(data, {list: list});
- log(data);
- }
if (before.nickname !== after.nickname) {
await client.database.history.create(
"nickname",
diff --git a/src/events/messageCreate.ts b/src/events/messageCreate.ts
index 7f8e5d1..44017d7 100644
--- a/src/events/messageCreate.ts
+++ b/src/events/messageCreate.ts
@@ -26,9 +26,9 @@
const content = message.content.toLowerCase() || "";
const config = await client.memory.readGuildInfo(message.guild.id);
if(config.filters.clean.channels.includes(message.channel.id)) {
- let memberRoles = message.member!.roles.cache.map(role => role.id);
- let roleAllow = config.filters.clean.allowed.roles.some(role => memberRoles.includes(role));
- let userAllow = config.filters.clean.allowed.user.includes(message.author.id);
+ const memberRoles = message.member!.roles.cache.map(role => role.id);
+ const roleAllow = config.filters.clean.allowed.roles.some(role => memberRoles.includes(role));
+ const userAllow = config.filters.clean.allowed.user.includes(message.author.id);
if(!roleAllow && !userAllow) return await message.delete();
}
diff --git a/src/events/stickerDelete.ts b/src/events/stickerDelete.ts
index fcfc3a6..87a991f 100644
--- a/src/events/stickerDelete.ts
+++ b/src/events/stickerDelete.ts
@@ -16,7 +16,7 @@
calculateType: "stickerUpdate",
color: NucleusColors.red,
emoji: "GUILD.STICKER.DELETE",
- timestamp: auditLog.createdTimestamp ?? Date.now()
+ timestamp: auditLog.createdTimestamp
},
list: {
stickerId: entry(sticker.id, `\`${sticker.id}\``),
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 111f1a0..fb6dde7 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -112,9 +112,9 @@
}
});
- let interactionMember = await interaction.guild?.members.fetch(interaction.user.id)
+ const interactionMember = await interaction.guild?.members.fetch(interaction.user.id)
- let newOut: Transcript = {
+ const newOut: Transcript = {
type: "ticket",
guild: interaction.guild!.id,
channel: interaction.channel!.id,
@@ -131,7 +131,7 @@
}
if(interactionMember?.roles.icon) newOut.createdBy.topRole.badgeURL = interactionMember.roles.icon.iconURL()!;
messages.reverse().forEach((message) => {
- let msg: TranscriptMessage = {
+ const msg: TranscriptMessage = {
id: message.id,
author: {
username: message.author.username,
@@ -146,7 +146,7 @@
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 => {
- let obj: TranscriptEmbed = {};
+ 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 => {
@@ -163,7 +163,7 @@
return obj;
});
if (message.components.length > 0) msg.components = message.components.map(component => component.components.map(child => {
- let obj: TranscriptComponent = {
+ const obj: TranscriptComponent = {
type: child.type
}
if (child.type === ComponentType.Button) {
@@ -175,7 +175,7 @@
return obj
}));
if (message.editedTimestamp) msg.editedTimestamp = message.editedTimestamp;
- if (message.flags) msg.flags = message.flags.toArray();
+ 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 ?? ""];
diff --git a/src/utils/createTemporaryStorage.ts b/src/utils/createTemporaryStorage.ts
index a684d9d..e8a8073 100644
--- a/src/utils/createTemporaryStorage.ts
+++ b/src/utils/createTemporaryStorage.ts
@@ -1,6 +1,6 @@
import client from "./client.js";
-function generalException(location: string) {
+export function generalException(location: string) {
client.noLog.push(location);
setTimeout(() => {
client.noLog = client.noLog.filter((i: string) => {
@@ -29,4 +29,4 @@
})
client.preloadPage = Object.fromEntries(object);
}, 60 * 5 * 1000);
-}
\ No newline at end of file
+}
diff --git a/src/utils/log.ts b/src/utils/log.ts
index 2d15192..87549dd 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -94,7 +94,7 @@
}
});
if (channel) {
- log.separate = log.separate || {};
+ log.separate = log.separate ?? {};
const embed = new Discord.EmbedBuilder()
.setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
.setDescription(