Fix the last of the eslint errors (for real this time)

pull/17/head
Skyler Grey 3 years ago
parent f21323a0b7
commit ad00217fd1
Signed by: Minion3665
GPG Key ID: 1AFD10256B3C714D

1
.gitignore vendored

@ -7,6 +7,7 @@ src/config/*
!src/config/emojis.json !src/config/emojis.json
src/config/main.json src/config/main.json
.vscode/ .vscode/
.vim/
yarn-error.log yarn-error.log
yarn.lock yarn.lock
src/utils/temp/*.png src/utils/temp/*.png

@ -26,7 +26,9 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
let reason = null; let reason = null;
let notify = true; let notify = true;
let confirmation; let confirmation;
while (true) { let cancelled = false;
let timedOut = false;
while (!timedOut && !cancelled) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.BAN.RED") .setEmoji("PUNISH.BAN.RED")
.setTitle("Ban") .setTitle("Ban")
@ -46,12 +48,12 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(reason !== null); .send(reason !== null);
reason = reason ?? ""; reason = reason ?? "";
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; else if (confirmation.success) cancelled = true;
if (confirmation.newReason) reason = confirmation.newReason; else if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) notify = confirmation.components.notify.active; else if (confirmation.components) notify = confirmation.components.notify.active;
} }
if (confirmation.success) { if (timedOut) return;
let dmd = false; let dmd = false;
let dm; let dm;
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);
@ -63,8 +65,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
.setEmoji("PUNISH.BAN.RED") .setEmoji("PUNISH.BAN.RED")
.setTitle("Banned") .setTitle("Banned")
.setDescription( .setDescription(
`You have been banned in ${interaction.guild.name}` + `You have been banned in ${interaction.guild.name}` + (reason ? ` for:\n> ${reason}` : ".")
(reason ? ` for:\n> ${reason}` : ".")
) )
.setStatus("Danger") .setStatus("Danger")
], ],
@ -142,18 +143,6 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
], ],
components: [] components: []
}); });
} else {
await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.BAN.GREEN")
.setTitle("Ban")
.setDescription("No changes were made")
.setStatus("Success")
],
components: []
});
}
}; };
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {

@ -103,7 +103,9 @@ async function showHistory(member: Discord.GuildMember, interaction: CommandInte
let refresh = true; let refresh = true;
let filteredTypes: string[] = []; let filteredTypes: string[] = [];
let openFilterPane = false; let openFilterPane = false;
while (true) { let timedOut = false;
let showHistorySelected = false;
while (!timedOut && !showHistorySelected) {
if (refresh) { if (refresh) {
history = await client.database.history.read(member.guild.id, member.id, currentYear); history = await client.database.history.read(member.guild.id, member.id, currentYear);
history = history history = history
@ -249,7 +251,8 @@ async function showHistory(member: Discord.GuildMember, interaction: CommandInte
.setFooter({ text: "Message timed out" }) .setFooter({ text: "Message timed out" })
] ]
}); });
return 0; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.customId === "filter") { if (i.customId === "filter") {
@ -289,13 +292,14 @@ async function showHistory(member: Discord.GuildMember, interaction: CommandInte
refresh = true; refresh = true;
} }
if (i.customId === "modNotes") { if (i.customId === "modNotes") {
return 1; showHistorySelected = true;
} }
if (i.customId === "openFilter") { if (i.customId === "openFilter") {
openFilterPane = !openFilterPane; openFilterPane = !openFilterPane;
refresh = true; refresh = true;
} }
} }
return timedOut ? 0 : 1;
} }
const callback = async (interaction: CommandInteraction): Promise<unknown> => { const callback = async (interaction: CommandInteraction): Promise<unknown> => {
@ -308,7 +312,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
}); });
let note; let note;
let firstLoad = true; let firstLoad = true;
while (true) { let timedOut = false;
while (!timedOut) {
note = await client.database.notes.read(member.guild.id, member.id); note = await client.database.notes.read(member.guild.id, member.id);
if (firstLoad && !note) { if (firstLoad && !note) {
await showHistory(member, interaction); await showHistory(member, interaction);
@ -341,7 +346,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
return; timedOut = true;
continue;
} }
if (i.customId === "modify") { if (i.customId === "modify") {
await i.showModal( await i.showModal(
@ -387,7 +393,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
(m) => m.customId === "modify" (m) => m.customId === "modify"
); );
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
if (out === null) { if (out === null) {
continue; continue;

@ -18,7 +18,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let reason = null; let reason = null;
let notify = true; let notify = true;
let confirmation; let confirmation;
while (true) { let timedOut = false;
let success = false;
while (!timedOut && !success) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.KICK.RED") .setEmoji("PUNISH.KICK.RED")
.setTitle("Kick") .setTitle("Kick")
@ -34,14 +36,14 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(reason !== null); .send(reason !== null);
reason = reason ?? ""; reason = reason ?? "";
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; else if (confirmation.success) success = true;
if (confirmation.newReason) reason = confirmation.newReason; else if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) { else if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
} }
} }
if (confirmation.success) { if (timedOut) return;
let dmd = false; let dmd = false;
let dm; let dm;
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);
@ -53,8 +55,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.setEmoji("PUNISH.KICK.RED") .setEmoji("PUNISH.KICK.RED")
.setTitle("Kicked") .setTitle("Kicked")
.setDescription( .setDescription(
`You have been kicked in ${interaction.guild.name}` + `You have been kicked in ${interaction.guild.name}` + (reason ? ` for:\n> ${reason}` : ".")
(reason ? ` for:\n> ${reason}` : ".")
) )
.setStatus("Danger") .setStatus("Danger")
], ],
@ -136,18 +137,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
], ],
components: [] components: []
}); });
} else {
await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.KICK.GREEN")
.setTitle("Kick")
.setDescription("No changes were made")
.setStatus("Success")
],
components: []
});
}
}; };
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {

@ -162,7 +162,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let notify = true; let notify = true;
let createAppealTicket = false; let createAppealTicket = false;
let confirmation; let confirmation;
while (true) { let timedOut = false;
let success = false;
while (!timedOut && !success) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.MUTE.RED") .setEmoji("PUNISH.MUTE.RED")
.setTitle("Mute") .setTitle("Mute")
@ -203,15 +205,15 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(true); .send(true);
reason = reason ?? ""; reason = reason ?? "";
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; if (confirmation.success) success = true;
if (confirmation.newReason) reason = confirmation.newReason; if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) { if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
createAppealTicket = confirmation.components.appeal.active; createAppealTicket = confirmation.components.appeal.active;
} }
} }
if (confirmation.success) { if (timedOut) return;
let dmd = false; let dmd = false;
let dm; let dm;
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);
@ -263,15 +265,11 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
await member.timeout(muteTime * 1000, reason || "No reason provided"); await member.timeout(muteTime * 1000, reason || "No reason provided");
if (config.moderation.mute.role !== null) { if (config.moderation.mute.role !== null) {
await member.roles.add(config.moderation.mute.role); await member.roles.add(config.moderation.mute.role);
await client.database.eventScheduler.schedule( await client.database.eventScheduler.schedule("naturalUnmute", new Date().getTime() + muteTime * 1000, {
"naturalUnmute",
new Date().getTime() + muteTime * 1000,
{
guild: interaction.guild.id, guild: interaction.guild.id,
user: user.id, user: user.id,
expires: new Date().getTime() + muteTime * 1000 expires: new Date().getTime() + muteTime * 1000
} });
);
} }
} }
} catch { } catch {
@ -347,18 +345,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
} }
}; };
log(data); log(data);
} else {
await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.MUTE.GREEN")
.setTitle("Mute")
.setDescription("No changes were made")
.setStatus("Success")
],
components: []
});
}
}; };
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {

@ -19,7 +19,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
// TODO:[Modals] Replace this with a modal // TODO:[Modals] Replace this with a modal
let notify = true; let notify = true;
let confirmation; let confirmation;
while (true) { let timedOut = false;
let success = false;
while (!timedOut && !success) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.NICKNAME.RED") .setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname") .setTitle("Nickname")
@ -46,13 +48,24 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
notify notify
) )
.send(interaction.options.getString("name") !== null); .send(interaction.options.getString("name") !== null);
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; else if (confirmation.success) success = true;
if (confirmation.components) { else if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
} }
} }
if (confirmation.success) { if (timedOut) {
return await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.NICKNAME.GREEN")
.setTitle("Nickname")
.setDescription("No changes were made")
.setStatus("Success")
],
components: []
});
}
let dmd = false; let dmd = false;
let dm; let dm;
try { try {
@ -63,9 +76,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.setEmoji("PUNISH.NICKNAME.RED") .setEmoji("PUNISH.NICKNAME.RED")
.setTitle("Nickname changed") .setTitle("Nickname changed")
.setDescription( .setDescription(
`Your nickname was ${ `Your nickname was ${interaction.options.getString("name") ? "changed" : "cleared"} in ${
interaction.options.getString("name") ? "changed" : "cleared" interaction.guild.name
} in ${interaction.guild.name}.` + }.` +
(interaction.options.getString("name") (interaction.options.getString("name")
? ` it is now: ${interaction.options.getString("name")}` ? ` it is now: ${interaction.options.getString("name")}`
: "") + : "") +
@ -149,18 +162,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
], ],
components: [] components: []
}); });
} else {
await interaction.editReply({
embeds: [
new EmojiEmbed()
.setEmoji("PUNISH.NICKNAME.GREEN")
.setTitle("Nickname")
.setDescription("No changes were made")
.setStatus("Success")
],
components: []
});
}
}; };
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {

@ -60,7 +60,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
fetchReply: true fetchReply: true
}); });
let deleted = [] as Discord.Message[]; let deleted = [] as Discord.Message[];
while (true) { let timedOut = false;
let amountSelected = false;
while (!timedOut && !amountSelected) {
const m = (await interaction.editReply({ const m = (await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -98,16 +100,16 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
time: 300000 time: 300000
}); });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
component.deferUpdate(); component.deferUpdate();
if (component.customId === "done") break; if (component.customId === "done") {
let amount; amountSelected = true;
try { continue;
amount = parseInt(component.customId);
} catch {
break;
} }
const amount = parseInt(component.customId);
let messages; let messages;
await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => { await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
if (user) { if (user) {

@ -26,7 +26,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let reason = null; let reason = null;
let notify = true; let notify = true;
let confirmation; let confirmation;
while (true) { let timedOut = false;
let success = false;
while (!timedOut && !success) {
const confirmation = await new confirmationMessage(interaction) const confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.BAN.RED") .setEmoji("PUNISH.BAN.RED")
.setTitle("Softban") .setTitle("Softban")
@ -55,13 +57,14 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(reason !== null); .send(reason !== null);
reason = reason ?? ""; reason = reason ?? "";
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; else if (confirmation.success) success = true;
if (confirmation.newReason) reason = confirmation.newReason; else if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) { else if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
} }
} }
if (timedOut) return;
if (confirmation.success) { if (confirmation.success) {
let dmd = false; let dmd = false;
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);

@ -17,7 +17,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let reason = null; let reason = null;
let notify = false; let notify = false;
let confirmation; let confirmation;
while (true) { let success = false;
while (!success) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.MUTE.RED") .setEmoji("PUNISH.MUTE.RED")
.setTitle("Unmute") .setTitle("Unmute")
@ -32,9 +33,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.setColor("Danger") .setColor("Danger")
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(reason !== null); .send(reason !== null);
if (confirmation.success) break; if (confirmation.success) success = true;
if (confirmation.newReason) reason = confirmation.newReason; else if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) { else if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
} }
} }

@ -56,7 +56,8 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
fetchReply: true fetchReply: true
}); });
let page = 0; let page = 0;
while (true) { let timedOut = false;
while (!timedOut) {
m = await interaction.editReply({ m = await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -144,7 +145,8 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
return; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.customId === "next") { if (i.customId === "next") {

@ -19,14 +19,16 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let notify = true; let notify = true;
let createAppealTicket = false; let createAppealTicket = false;
let confirmation; let confirmation;
while (true) { let timedOut = false;
let success = false;
while (!timedOut && !success) {
confirmation = await new confirmationMessage(interaction) confirmation = await new confirmationMessage(interaction)
.setEmoji("PUNISH.WARN.RED") .setEmoji("PUNISH.WARN.RED")
.setTitle("Warn") .setTitle("Warn")
.setDescription( .setDescription(
keyValueList({ keyValueList({
user: renderUser(interaction.options.getUser("user")), user: renderUser(interaction.options.getUser("user")),
reason: reason ? "\n> " + (reason ?? "").replaceAll("\n", "\n> ") : "*No reason provided*" reason: reason ? "\n> " + reason.replaceAll("\n", "\n> ") : "*No reason provided*"
}) + }) +
`The user **will${notify ? "" : " not"}** be notified\n\n` + `The user **will${notify ? "" : " not"}** be notified\n\n` +
`Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?` `Are you sure you want to warn <@!${(interaction.options.getMember("user") as GuildMember).id}>?`
@ -54,14 +56,15 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
.addReasonButton(reason ?? "") .addReasonButton(reason ?? "")
.send(reason !== null); .send(reason !== null);
reason = reason ?? ""; reason = reason ?? "";
if (confirmation.cancelled) return; if (confirmation.cancelled) timedOut = true;
if (confirmation.success) break; else if (confirmation.success) success = true;
if (confirmation.newReason) reason = confirmation.newReason; else if (confirmation.newReason) reason = confirmation.newReason;
if (confirmation.components) { else if (confirmation.components) {
notify = confirmation.components.notify.active; notify = confirmation.components.notify.active;
createAppealTicket = confirmation.components.appeal.active; createAppealTicket = confirmation.components.appeal.active;
} }
} }
if (timedOut) return;
if (confirmation.success) { if (confirmation.success) {
let dmd = false; let dmd = false;
try { try {
@ -284,11 +287,10 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const check = (interaction: CommandInteraction) => { const check = (interaction: CommandInteraction) => {
const member = interaction.member as GuildMember; const member = interaction.member as GuildMember;
const me = interaction.guild.me!; const apply = interaction.options.getMember("user") as GuildMember | null;
const apply = interaction.options.getMember("user") as GuildMember; if (apply === null) throw new Error("That member is not in the server");
if (member === null || me === null || apply === null) throw new Error("That member is not in the server"); const memberPos = member.roles.cache.size ? member.roles.highest.position : 0;
const memberPos = member.roles ? member.roles.highest.position : 0; const applyPos = apply.roles.cache.size ? apply.roles.highest.position : 0;
const applyPos = apply.roles ? apply.roles.highest.position : 0;
// Do not allow warning bots // Do not allow warning bots
if (member.user.bot) throw new Error("I cannot warn bots"); if (member.user.bot) throw new Error("I cannot warn bots");
// Allow the owner to warn anyone // Allow the owner to warn anyone

@ -122,7 +122,8 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
let selectPaneOpen = false; let selectPaneOpen = false;
let nextFooter = null; let nextFooter = null;
while (true) { let timedOut = false;
while (!timedOut) {
let selectPane = []; let selectPane = [];
if (selectPaneOpen) { if (selectPaneOpen) {
@ -176,7 +177,8 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
nextFooter = null; nextFooter = null;
i.deferUpdate(); i.deferUpdate();

@ -94,8 +94,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => { const check = (interaction: CommandInteraction, _defaultCheck: WrappedCheck) => {
const member = interaction.member as GuildMember; const member = interaction.member as GuildMember;
const me = interaction.guild.me!; const me = interaction.guild.me!;
const apply = interaction.options.getMember("user") as GuildMember; const apply = interaction.options.getMember("user") as GuildMember | null;
if (member === null || me === null || apply === null) throw new Error("That member is not in the server"); if (apply === null) throw new Error("That member is not in the server");
// Check if Nucleus has permission to role // Check if Nucleus has permission to role
if (!me.permissions.has("MANAGE_ROLES")) throw new Error("I do not have the *Manage Roles* permission"); if (!me.permissions.has("MANAGE_ROLES")) throw new Error("I do not have the *Manage Roles* permission");
// Allow the owner to role anyone // Allow the owner to role anyone

@ -50,7 +50,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
}); });
} }
} }
while (true) { let timedOut = false;
while (!timedOut) {
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);
const moderation = config.getKey("moderation"); const moderation = config.getKey("moderation");
m = await interaction.editReply({ m = await interaction.editReply({
@ -119,7 +120,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
return; timedOut = true;
continue;
} }
let chosen = moderation[i.customId] ?? { text: null, url: null }; let chosen = moderation[i.customId] ?? { text: null, url: null };
if (i.component.customId === "clearMuteRole") { if (i.component.customId === "clearMuteRole") {

@ -117,7 +117,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let clicks = 0; let clicks = 0;
const data = await client.database.guilds.read(interaction.guild.id); const data = await client.database.guilds.read(interaction.guild.id);
let channel = data.logging.staff.channel; let channel = data.logging.staff.channel;
while (true) {
let timedOut = false;
while (!timedOut) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -148,7 +150,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.component.customId === "clear") { if (i.component.customId === "clear") {
@ -158,8 +161,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]); await client.database.guilds.write(interaction.guild.id, null, ["logging.announcements.channel"]);
channel = undefined; channel = undefined;
} }
} else {
break;
} }
} }
await interaction.editReply({ await interaction.editReply({

@ -114,7 +114,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let clicks = 0; let clicks = 0;
const data = await client.database.guilds.read(interaction.guild.id); const data = await client.database.guilds.read(interaction.guild.id);
let channel = data.logging.logs.channel; let channel = data.logging.logs.channel;
while (true) { let timedOut = false;
while (!timedOut) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -142,7 +143,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
} }
i.deferUpdate(); i.deferUpdate();
if (i.component.customId === "clear") { if (i.component.customId === "clear") {
@ -152,8 +153,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"]); await client.database.guilds.write(interaction.guild.id, null, ["logging.logs.channel"]);
channel = undefined; channel = undefined;
} }
} else {
break;
} }
} }
await interaction.editReply({ await interaction.editReply({

@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js"; import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js"; import Discord, { CommandInteraction, Message, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku"; import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js"; import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@ -38,11 +38,12 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
fetchReply: true, fetchReply: true,
ephemeral: true ephemeral: true
}); });
let m; let m: Message;
while (true) { let timedOut = false;
do {
const config = await client.database.guilds.read(interaction.guild.id); const config = await client.database.guilds.read(interaction.guild.id);
const converted = toHexArray(config.logging.logs.toLog); const converted = toHexArray(config.logging.logs.toLog);
m = await interaction.editReply({ m = (await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
.setTitle("Logging Events") .setTitle("Logging Events")
@ -72,12 +73,13 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
new MessageButton().setLabel("Select none").setStyle("DANGER").setCustomId("none") new MessageButton().setLabel("Select none").setStyle("DANGER").setCustomId("none")
]) ])
] ]
}); })) as Message;
let i; let i;
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.customId === "logs") { if (i.customId === "logs") {
@ -95,22 +97,10 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
await client.database.guilds.write(interaction.guild.id, { await client.database.guilds.write(interaction.guild.id, {
"logging.logs.toLog": 0 "logging.logs.toLog": 0
}); });
} else {
break;
}
} }
m = await interaction.editReply({ } while (!timedOut);
embeds: [
new EmojiEmbed() await interaction.editReply({ embeds: [m.embeds[0]!.setFooter({ text: "Message timed out" })] });
.setTitle("Logging Events")
.setDescription(
"Below are the events being logged in the server. You can toggle them on and off in the dropdown"
)
.setFooter({ text: "Message timed out" })
.setStatus("Success")
.setEmoji("CHANNEL.TEXT.CREATE")
]
});
return; return;
}; };

@ -119,7 +119,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let clicks = 0; let clicks = 0;
const data = await client.database.guilds.read(interaction.guild.id); const data = await client.database.guilds.read(interaction.guild.id);
let channel = data.logging.staff.channel; let channel = data.logging.staff.channel;
while (true) { let timedOut = false;
while (!timedOut) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -147,7 +148,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if ((i.component as MessageButton).customId === "clear") { if ((i.component as MessageButton).customId === "clear") {
@ -157,8 +159,6 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"]); await client.database.guilds.write(interaction.guild.id, null, ["logging.staff.channel"]);
channel = undefined; channel = undefined;
} }
} else {
break;
} }
} }
await interaction.editReply({ await interaction.editReply({

@ -148,7 +148,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
} }
await statsChannelAddCallback(client, interaction.member); await statsChannelAddCallback(client, interaction.member);
} }
while (true) { let timedOut = false;
while (!timedOut) {
config = await client.database.guilds.read(interaction.guild.id); config = await client.database.guilds.read(interaction.guild.id);
const stats = config.getKey("stats"); const stats = config.getKey("stats");
const selectMenu = new MessageSelectMenu() const selectMenu = new MessageSelectMenu()
@ -198,7 +199,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.customId === "remove") { if (i.customId === "remove") {
@ -211,7 +213,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
} }
} }
await interaction.editReply({ await interaction.editReply({
embeds: [m.embeds[0]!.setFooter({ text: "Message closed" })], embeds: [m.embeds[0]!.setFooter({ text: "Message timed out" })],
components: [] components: []
}); });
}; };

@ -67,13 +67,12 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
fetchReply: true fetchReply: true
})) as Message; })) as Message;
const options = { const options = {
enabled: interaction.options.getString("enabled") as string | boolean | null, enabled: interaction.options.getString("enabled")?.startsWith("yes") as boolean | null,
category: interaction.options.getChannel("category"), category: interaction.options.getChannel("category"),
maxtickets: interaction.options.getNumber("maxticketsperuser"), maxtickets: interaction.options.getNumber("maxticketsperuser"),
supportping: interaction.options.getRole("supportrole") supportping: interaction.options.getRole("supportrole")
}; };
if (options.enabled !== null || options.category || options.maxtickets || options.supportping) { if (options.enabled !== null || options.category || options.maxtickets || options.supportping) {
options.enabled = options.enabled === "yes" ? true : false;
if (options.category) { if (options.category) {
let channel: GuildChannel | null; let channel: GuildChannel | null;
try { try {
@ -211,7 +210,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
types: data.tickets.types, types: data.tickets.types,
customTypes: data.tickets.customTypes customTypes: data.tickets.customTypes
}; };
while (true) { let timedOut = false;
while (!timedOut) {
embed = new EmojiEmbed() embed = new EmojiEmbed()
.setTitle("Tickets") .setTitle("Tickets")
.setDescription( .setDescription(
@ -276,7 +276,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "clearCategory") { if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
@ -312,7 +313,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
description: "Click the button below to speak to us privately" description: "Click the button below to speak to us privately"
} }
]; ];
while (true) { let innerTimedOut = false;
let templateSelected = false;
while (!innerTimedOut && !templateSelected) {
const enabled = data.enabled && data.category !== null; const enabled = data.enabled && data.category !== null;
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
@ -373,7 +376,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; innerTimedOut = true;
continue;
} }
if ((i.component as MessageActionRowComponent).customId === "template") { if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate(); i.deferUpdate();
@ -397,7 +401,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
continue;
} else if ((i.component as MessageActionRowComponent).customId === "blank") { } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate(); i.deferUpdate();
await interaction.channel!.send({ await interaction.channel!.send({
@ -411,7 +416,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
continue;
} else if ((i.component as MessageActionRowComponent).customId === "custom") { } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal( await i.showModal(
new Discord.Modal() new Discord.Modal()
@ -462,7 +468,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
(m) => m.customId === "modify" (m) => m.customId === "modify"
); );
} catch (e) { } catch (e) {
break; innerTimedOut = true;
continue;
} }
if (out.fields) { if (out.fields) {
const title = out.fields.getTextInputValue("title"); const title = out.fields.getTextInputValue("title");
@ -485,9 +492,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
} else {
continue;
} }
} }
} }
@ -498,18 +503,18 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
data.enabled = !data.enabled; data.enabled = !data.enabled;
} else if ((i.component as MessageActionRowComponent).customId === "manageTypes") { } else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
data = await manageTypes(interaction, data, m as Message); data = await manageTypes(interaction, data, m as Message);
} else {
break;
} }
} }
await interaction.editReply({ await interaction.editReply({
embeds: [embed.setFooter({ text: "Message closed" })], embeds: [embed.setFooter({ text: "Message timed out" })],
components: [] components: []
}); });
}; };
async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) { async function manageTypes(interaction: CommandInteraction, data: GuildConfig["tickets"], m: Message) {
while (true) { let timedOut = false;
let backPressed = false;
while (!timedOut && !backPressed) {
if (data.useCustom) { if (data.useCustom) {
const customTypes = data.customTypes; const customTypes = data.customTypes;
await interaction.editReply({ await interaction.editReply({
@ -622,7 +627,8 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
if (i.component.customId === "types") { if (i.component.customId === "types") {
i.deferUpdate(); i.deferUpdate();
@ -700,7 +706,7 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
} catch { } catch {
continue; continue;
} }
data.customTypes = data.customTypes || []; data.customTypes = data.customTypes ?? [];
if (!data.customTypes.includes(toAdd)) { if (!data.customTypes.includes(toAdd)) {
data.customTypes.push(toAdd); data.customTypes.push(toAdd);
} }
@ -717,7 +723,7 @@ async function manageTypes(interaction: CommandInteraction, data: GuildConfig["t
data.useCustom = true; data.useCustom = true;
} else { } else {
i.deferUpdate(); i.deferUpdate();
break; backPressed = true;
} }
} }
return data; return data;

@ -124,7 +124,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
let clicks = 0; let clicks = 0;
const data = await client.database.guilds.read(interaction.guild!.id); const data = await client.database.guilds.read(interaction.guild!.id);
let role = data.verify.role; let role = data.verify.role;
while (true) {
let timedOut = false;
while (!timedOut) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -155,7 +157,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "clear") { if ((i.component as MessageActionRowComponent).customId === "clear") {
@ -180,7 +183,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
description: "Click the button below to verify yourself" description: "Click the button below to verify yourself"
} }
]; ];
while (true) { let innerTimedOut = false;
let templateSelected = false;
while (!innerTimedOut && !templateSelected) {
await interaction.editReply({ await interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -238,7 +243,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; innerTimedOut = true;
continue;
} }
if ((i.component as MessageActionRowComponent).customId === "template") { if ((i.component as MessageActionRowComponent).customId === "template") {
i.deferUpdate(); i.deferUpdate();
@ -262,7 +268,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
continue;
} else if ((i.component as MessageActionRowComponent).customId === "blank") { } else if ((i.component as MessageActionRowComponent).customId === "blank") {
i.deferUpdate(); i.deferUpdate();
await interaction.channel!.send({ await interaction.channel!.send({
@ -276,7 +283,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
continue;
} else if ((i.component as MessageActionRowComponent).customId === "custom") { } else if ((i.component as MessageActionRowComponent).customId === "custom") {
await i.showModal( await i.showModal(
new Discord.Modal() new Discord.Modal()
@ -329,11 +337,10 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
(m) => m.customId === "modify" (m) => m.customId === "modify"
); );
} catch (e) { } catch (e) {
break; innerTimedOut = true;
}
if (out === null) {
continue; continue;
} else if (out instanceof ModalSubmitInteraction) { }
if (out !== null && out instanceof ModalSubmitInteraction) {
const title = out.fields.getTextInputValue("title"); const title = out.fields.getTextInputValue("title");
const description = out.fields.getTextInputValue("description"); const description = out.fields.getTextInputValue("description");
await interaction.channel!.send({ await interaction.channel!.send({
@ -354,9 +361,7 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
]) ])
] ]
}); });
break; templateSelected = true;
} else {
continue;
} }
} }
} }

@ -172,7 +172,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
} }
} }
let lastClicked = null; let lastClicked = null;
while (true) { let timedOut = false;
do {
const config = await client.database.guilds.read(interaction.guild!.id); const config = await client.database.guilds.read(interaction.guild!.id);
m = (await interaction.editReply({ m = (await interaction.editReply({
embeds: [ embeds: [
@ -239,7 +240,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
break; timedOut = true;
continue;
} }
i.deferUpdate(); i.deferUpdate();
if (i.customId == "clear-message") { if (i.customId == "clear-message") {
@ -284,9 +286,9 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
}); });
lastClicked = null; lastClicked = null;
} }
} } while (!timedOut);
await interaction.editReply({ await interaction.editReply({
embeds: [m.embeds[0]!.setFooter({ text: "Message closed" })], embeds: [m.embeds[0]!.setFooter({ text: "Message timed out" })],
components: [] components: []
}); });
}; };

@ -7,9 +7,10 @@ import Discord, {
MessageActionRowComponent, MessageActionRowComponent,
MessageButton, MessageButton,
MessageComponentInteraction, MessageComponentInteraction,
MessageSelectOptionData,
SelectMenuInteraction SelectMenuInteraction
} from "discord.js"; } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders"; import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js"; import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js"; import getEmojiByName from "../../utils/getEmojiByName.js";
import generateKeyValueList from "../../utils/generateKeyValueList.js"; import generateKeyValueList from "../../utils/generateKeyValueList.js";
@ -224,22 +225,20 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
ephemeral: true ephemeral: true
})) as Message; })) as Message;
let page = 0; let page = 0;
let breakReason = ""; let timedOut = false;
while (true) { while (!timedOut) {
const em = new Discord.MessageEmbed(embeds[page].embed); const em = new Discord.MessageEmbed(embeds[page].embed);
em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page)); em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
let selectPane = []; let selectPane = [];
if (selectPaneOpen) { if (selectPaneOpen) {
const options = []; const options: MessageSelectOptionData[] = [];
embeds.forEach((embed) => { embeds.forEach((embed) => {
options.push( options.push({
new SelectMenuOption({
label: embed.title, label: embed.title,
value: embed.pageId.toString(), value: embed.pageId.toString(),
description: embed.description || "" description: embed.description || ""
}) });
);
}); });
selectPane = [ selectPane = [
new MessageActionRow().addComponents([ new MessageActionRow().addComponents([
@ -269,11 +268,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id")) .setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
.setCustomId("right") .setCustomId("right")
.setStyle("SECONDARY") .setStyle("SECONDARY")
.setDisabled(page === embeds.length - 1), .setDisabled(page === embeds.length - 1)
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("close")
.setStyle("DANGER")
]) ])
]) ])
}); });
@ -281,8 +276,8 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
try { try {
i = await m.awaitMessageComponent({ time: 300000 }); i = await m.awaitMessageComponent({ time: 300000 });
} catch { } catch {
breakReason = "Message timed out"; timedOut = true;
break; continue;
} }
i.deferUpdate(); i.deferUpdate();
if ((i.component as MessageActionRowComponent).customId === "left") { if ((i.component as MessageActionRowComponent).customId === "left") {
@ -293,45 +288,16 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
selectPaneOpen = false; selectPaneOpen = false;
} else if ((i.component as MessageActionRowComponent).customId === "select") { } else if ((i.component as MessageActionRowComponent).customId === "select") {
selectPaneOpen = !selectPaneOpen; selectPaneOpen = !selectPaneOpen;
} else if ((i.component as MessageActionRowComponent).customId === "close") {
breakReason = "Message closed";
break;
} else if ((i.component as MessageActionRowComponent).customId === "page") { } else if ((i.component as MessageActionRowComponent).customId === "page") {
page = parseInt((i as SelectMenuInteraction).values[0]); page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false; selectPaneOpen = false;
} else {
breakReason = "Message closed";
break;
} }
} }
const em = new Discord.MessageEmbed(embeds[page].embed); const em = new Discord.MessageEmbed(embeds[page].embed);
em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | " + breakReason); em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | Message closed");
await interaction.editReply({ await interaction.editReply({
embeds: [em], embeds: [em],
components: [ components: []
new MessageActionRow().addComponents([
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
.setStyle("SECONDARY")
.setCustomId("left")
.setDisabled(true),
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.MENU", "id"))
.setStyle("SECONDARY")
.setCustomId("select")
.setDisabled(true),
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
.setCustomId("right")
.setStyle("SECONDARY")
.setDisabled(true),
new MessageButton()
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("close")
.setStyle("DANGER")
.setDisabled(true)
])
]
}); });
}; };

@ -35,7 +35,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
const roles = await guild.roles.fetch(); const roles = await guild.roles.fetch();
const memberRoles = member.roles; const memberRoles = member.roles;
let managed: boolean; let managed: boolean;
while (true) { let timedOut = false;
while (!timedOut) {
const data = config.tracks[track]; const data = config.tracks[track];
if (data.manageableBy !== undefined) if (data.manageableBy !== undefined)
managed = data.manageableBy.some((element: string) => { managed = data.manageableBy.some((element: string) => {
@ -169,7 +170,8 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
try { try {
component = await m.awaitMessageComponent({ time: 300000 }); component = await m.awaitMessageComponent({ time: 300000 });
} catch (e) { } catch (e) {
return; timedOut = true;
continue;
} }
component.deferUpdate(); component.deferUpdate();
if (component.customId === "conflict") { if (component.customId === "conflict") {

@ -34,13 +34,13 @@ export class Guilds {
this.defaultData = null; this.defaultData = null;
} }
async setup() { async setup(): Promise<Guilds> {
this.defaultData = (await import("../config/default.json", { assert: { type: "json" } })) this.defaultData = (await import("../config/default.json", { assert: { type: "json" } }))
.default as unknown as GuildConfig; .default as unknown as GuildConfig;
return this; return this;
} }
async read(guild: string) { async read(guild: string): Promise<GuildConfig> {
const entry = await this.guilds.findOne({ id: guild }); const entry = await this.guilds.findOne({ id: guild });
return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig; return new Proxy(structuredClone(this.defaultData), Entry(entry)) as unknown as GuildConfig;
} }
@ -242,10 +242,6 @@ export interface GuildConfig {
}; };
welcome: { welcome: {
enabled: boolean; enabled: boolean;
verificationRequired: {
message: boolean;
role: string | null;
};
role: string | null; role: string | null;
ping: string | null; ping: string | null;
channel: string | null; channel: string | null;
@ -256,7 +252,7 @@ export interface GuildConfig {
logs: { logs: {
enabled: boolean; enabled: boolean;
channel: string | null; channel: string | null;
toLog: string | null; toLog: string;
}; };
staff: { staff: {
channel: string | null; channel: string | null;
@ -267,14 +263,13 @@ export interface GuildConfig {
}; };
}; };
verify: { verify: {
enabled: boolean;
role: string | null; role: string | null;
}; };
tickets: { tickets: {
enabled: boolean; enabled: boolean;
category: string | null; category: string | null;
types: string | null; types: string;
customTypes: string[]; customTypes: string[] | null;
useCustom: boolean; useCustom: boolean;
supportRole: string | null; supportRole: string | null;
maxTickets: number; maxTickets: number;

Loading…
Cancel
Save