fixing eslint

pull/11/head
TheCodedProf 3 years ago
parent e35c4596ee
commit 1807fb31d9

@ -100,7 +100,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
...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"),

@ -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 callback = async (interaction: CommandInteraction): Promise<void> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
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.LOGO")
.setEmoji("NUCLEUS.PREMIUMACTIVATE")
.setStatus("Danger")
],
components: [
new ActionRowBuilder<ButtonBuilder>()
.addComponents(
new ButtonBuilder()
.setStyle(ButtonStyle.Primary)
.setLabel("Activate Premium here")
.setCustomId("premiumActivate")
.setDisabled(count <= 0 && hasPremium)
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: []
});
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 };

@ -44,7 +44,7 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
});
let closed = false;
let data: Data = {
const data: Data = {
buttons: [],
title: null,
description: null,
@ -201,9 +201,9 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
}
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 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
.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 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
}
}
} 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]!]!;

@ -646,9 +646,9 @@ const mentionMenu = async (interaction: StringSelectMenuInteraction, m: Message,
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 @@ const cleanMenu = async (interaction: StringSelectMenuInteraction, m: Message, c
} 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 @@ const cleanMenu = async (interaction: StringSelectMenuInteraction, m: Message, c
} while(!closed);
return current;
return current as {
channels: string[],
allowed: {
roles: string[],
user: string[]
}
};
}

@ -58,7 +58,7 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
}) as Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction;
} catch (e) {
closed = true;
break;
continue;
}
if(i.isButton()) {
@ -87,7 +87,7 @@ export const callback = async (interaction: CommandInteraction): Promise<void> =
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;

@ -18,7 +18,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;
} catch (e) {
closed = true;
break;
continue;
}
await i.deferUpdate();
if(i.isButton()) {

@ -104,7 +104,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
`**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 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
}) as ButtonInteraction | StringSelectMenuInteraction | ChannelSelectMenuInteraction;
} catch (e) {
closed = true;
break;
continue;
}
await i.deferUpdate();
@ -147,7 +147,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
}
}
} 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]!;

@ -66,7 +66,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
})) as Discord.ButtonInteraction | Discord.SelectMenuInteraction;
} catch (e) {
closed = true;
break;
continue;
}
await i.deferUpdate();
if(i.isButton()) {

@ -154,7 +154,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
}
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 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
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);
}

@ -217,7 +217,7 @@ const editTrack = async (interaction: ButtonInteraction | StringSelectMenuIntera
)
.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});

@ -215,7 +215,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
out = null;
}
if(!out) break;
data.message = out.fields.getTextInputValue("message") ?? null;
data.message = out.fields.getTextInputValue("message");
break;
}
case "save": {

@ -19,9 +19,9 @@ const command = (builder: SlashCommandSubcommandBuilder) =>
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: [

@ -27,12 +27,12 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
);
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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
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 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
await member.roles.remove(rolesToRemove);
rolesToChange = [];
break;
case "roleDiscard":
}
case "roleDiscard": {
rolesToChange = [];
await interaction.editReply({ embeds: LoadingEmbed, components: [] });
break;
}
}
} else {
rolesToChange = i.values;

@ -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;
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);
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)),
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: {
let list = {
memberId: entry(after.id, `\`${after.id}\``),
name: entry(after.user.id, renderUser(after.user)),
};
},
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(", "))});
}
};
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);
}
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.nickname !== after.nickname) {
await client.database.history.create(
"nickname",

@ -26,9 +26,9 @@ export async function callback(_client: NucleusClient, message: Message) {
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();
}

@ -16,7 +16,7 @@ export async function callback(client: NucleusClient, sticker: Sticker) {
calculateType: "stickerUpdate",
color: NucleusColors.red,
emoji: "GUILD.STICKER.DELETE",
timestamp: auditLog.createdTimestamp ?? Date.now()
timestamp: auditLog.createdTimestamp
},
list: {
stickerId: entry(sticker.id, `\`${sticker.id}\``),

@ -112,9 +112,9 @@ export default async function (interaction: CommandInteraction | MessageComponen
}
});
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 @@ export default async function (interaction: CommandInteraction | MessageComponen
}
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 @@ export default async function (interaction: CommandInteraction | MessageComponen
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 @@ export default async function (interaction: CommandInteraction | MessageComponen
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 @@ export default async function (interaction: CommandInteraction | MessageComponen
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 ?? ""];

@ -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 @@ export function preloadPage(target: string, command: string, message: string) {
})
client.preloadPage = Object.fromEntries(object);
}, 60 * 5 * 1000);
}
}

@ -94,7 +94,7 @@ export const Logger = {
}
});
if (channel) {
log.separate = log.separate || {};
log.separate = log.separate ?? {};
const embed = new Discord.EmbedBuilder()
.setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
.setDescription(

Loading…
Cancel
Save