huge changes once again
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 448f26a..19a389b 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,6 +1,6 @@
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
-import generateEmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,7 +17,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new generateEmojiEmbed()
+ m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Loading")
.setStatus("Danger")
.setEmoji("NUCLEUS.LOADING")
@@ -27,7 +27,7 @@
try {
channel = interaction.options.getChannel("channel")
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Log Channel")
.setDescription("The channel you provided is not a valid channel")
@@ -36,7 +36,7 @@
}
channel = channel as Discord.TextChannel
if (channel.guild.id != interaction.guild.id) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log Channel")
.setDescription(`You must choose a channel in this server`)
.setStatus("Danger")
@@ -52,10 +52,10 @@
.send(true)
if (confirmation.success) {
try {
- await client.database.write(interaction.guild.id, {"logging.logs.channel": channel.id})
+ await client.database.guilds.write(interaction.guild.id, {"logging.logs.channel": channel.id})
} catch (e) {
console.log(e)
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log Channel")
.setDescription(`Something went wrong and the log channel could not be set`)
.setStatus("Danger")
@@ -63,7 +63,7 @@
], components: []});
}
} else {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log Channel")
.setDescription(`No changes were made`)
.setStatus("Success")
@@ -72,10 +72,10 @@
}
}
let clicks = 0;
- let data = await client.database.read(interaction.guild.id);
+ let data = await client.database.guilds.read(interaction.guild.id);
let channel = data.logging.logs.channel;
while (true) {
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log channel")
.setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
.setStatus("Success")
@@ -96,14 +96,14 @@
clicks += 1;
if (clicks == 2) {
clicks = 0;
- await client.database.write(interaction.guild.id, {}, ["logging.logs.channel"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["logging.logs.channel"])
channel = undefined;
}
} else {
break
}
}
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Log channel")
.setDescription(channel ? `Your log channel is currently set to <#${channel}>` : "This server does not have a log channel")
.setStatus("Success")
diff --git a/src/commands/settings/logs/ignore.ts b/src/commands/settings/logs/ignore.ts
index 4b66307..12af085 100644
--- a/src/commands/settings/logs/ignore.ts
+++ b/src/commands/settings/logs/ignore.ts
@@ -1,7 +1,7 @@
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
-import generateEmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import { WrappedCheck } from "jshaiku";
import confirmationMessage from '../../../utils/confirmationMessage.js';
import keyValueList from '../../../utils/generateKeyValueList.js';
@@ -24,7 +24,7 @@
let channel = interaction.options.getChannel("addchannel")
let user = interaction.options.getUser("adduser")
let role = interaction.options.getRole("addrole")
- await interaction.reply({embeds: [new generateEmojiEmbed()
+ await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Loading")
.setStatus("Danger")
.setEmoji("NUCLEUS.LOADING")
@@ -34,7 +34,7 @@
try {
channel = interaction.guild.channels.cache.get(channel.id)
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Logs > Ignore")
.setDescription("The channel you provided is not a valid channel")
@@ -43,7 +43,7 @@
}
channel = channel as Discord.TextChannel
if (channel.guild.id != interaction.guild.id) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Logs > Ignore")
.setDescription(`You must choose a channel in this server`)
.setStatus("Danger")
@@ -55,7 +55,7 @@
try {
user = interaction.guild.members.cache.get(user.id).user
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("USER.DELETE")
.setTitle("Logs > Ignore")
.setDescription("The user you provided is not a valid user")
@@ -68,7 +68,7 @@
try {
role = interaction.guild.roles.cache.get(role.id)
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("ROLE.DELETE")
.setTitle("Logs > Ignore")
.setDescription("The role you provided is not a valid role")
@@ -77,7 +77,7 @@
}
role = role as Discord.Role
if (role.guild.id != interaction.guild.id) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Logs > Ignore")
.setDescription(`You must choose a role in this server`)
.setStatus("Danger")
@@ -97,12 +97,12 @@
.setColor("Warning")
.send(true)
if (confirmation.success) {
- let data = client.database.read(interaction.guild.id)
+ let data = client.database.guilds.read(interaction.guild.id)
if (channel) data.logging.logs.ignore.channels.concat([channel.id])
if (user) data.logging.logs.ignore.users.concat([user.id])
if (role) data.logging.logs.ignore.roles.concat([role.id])
if (interaction.options.getString("action") == "add") {
- await client.database.append(interaction.guild.id, data)
+ await client.database.guilds.append(interaction.guild.id, data)
}
}
}
diff --git a/src/commands/settings/staff/channel.ts b/src/commands/settings/staff/channel.ts
index 354d7f1..74605cf 100644
--- a/src/commands/settings/staff/channel.ts
+++ b/src/commands/settings/staff/channel.ts
@@ -1,6 +1,6 @@
import { ChannelType } from 'discord-api-types';
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
-import generateEmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -17,7 +17,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new generateEmojiEmbed()
+ m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Loading")
.setStatus("Danger")
.setEmoji("NUCLEUS.LOADING")
@@ -27,7 +27,7 @@
try {
channel = interaction.options.getChannel("channel")
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Staff Notifications Channel")
.setDescription("The channel you provided is not a valid channel")
@@ -36,7 +36,7 @@
}
channel = channel as Discord.TextChannel
if (channel.guild.id != interaction.guild.id) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications Channel")
.setDescription(`You must choose a channel in this server`)
.setStatus("Danger")
@@ -55,9 +55,9 @@
.send(true)
if (confirmation.success) {
try {
- await client.database.write(interaction.guild.id, {"logging.staff.channel": channel.id})
+ await client.database.guilds.write(interaction.guild.id, {"logging.staff.channel": channel.id})
} catch (e) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications Channel")
.setDescription(`Something went wrong and the staff notifications channel could not be set`)
.setStatus("Danger")
@@ -65,7 +65,7 @@
], components: []});
}
} else {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications Channel")
.setDescription(`No changes were made`)
.setStatus("Success")
@@ -74,10 +74,10 @@
}
}
let clicks = 0;
- let data = await client.database.read(interaction.guild.id);
+ let data = await client.database.guilds.read(interaction.guild.id);
let channel = data.logging.staff.channel;
while (true) {
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications channel")
.setDescription(channel ? `Your staff notifications channel is currently set to <#${channel}>` : "This server does not have a staff notifications channel")
.setStatus("Success")
@@ -98,14 +98,14 @@
clicks += 1;
if (clicks == 2) {
clicks = 0;
- await client.database.write(interaction.guild.id, {}, ["logging.staff.channel"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["logging.staff.channel"])
channel = undefined;
}
} else {
break
}
}
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Staff Notifications channel")
.setDescription(channel ? `Your staff notifications channel is currently set to <#${channel}>` : "This server does not have a staff notifications channel")
.setStatus("Success")
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 670a2f2..b505c5c 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -1,5 +1,5 @@
import getEmojiByName from "../../utils/getEmojiByName.js";
-import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import Discord, { CommandInteraction, MessageActionRow, MessageButton, MessageSelectMenu, TextInputComponent } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -22,7 +22,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
m = await interaction.reply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Loading")
.setStatus("Danger")
.setEmoji("NUCLEUS.LOADING")
@@ -42,7 +42,7 @@
channel = interaction.guild.channels.cache.get(options.category.id)
} catch {
return await interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setEmoji("CHANNEL.TEXT.DELETE")
.setTitle("Tickets > Category")
.setDescription("The channel you provided is not a valid category")
@@ -52,7 +52,7 @@
}
channel = channel as Discord.CategoryChannel
if (channel.guild.id != interaction.guild.id) return interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Category")
.setDescription(`You must choose a category in this server`)
.setStatus("Danger")
@@ -62,7 +62,7 @@
}
if (options.maxtickets) {
if (options.maxtickets < 1) return interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Max Tickets")
.setDescription(`You must choose a number greater than 0`)
.setStatus("Danger")
@@ -76,7 +76,7 @@
role = interaction.guild.roles.cache.get(options.supportping.id)
} catch {
return await interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLE.DELETE")
.setTitle("Tickets > Support Ping")
.setDescription("The role you provided is not a valid role")
@@ -86,7 +86,7 @@
}
role = role as Discord.Role
if (role.guild.id != interaction.guild.id) return interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Support Ping")
.setDescription(`You must choose a role in this server`)
.setStatus("Danger")
@@ -116,10 +116,10 @@
if (options.maxtickets) toUpdate["tickets.maxTickets"] = options.maxtickets
if (options.supportping) toUpdate["tickets.supportRole"] = options.supportping.id
try {
- await client.database.write(interaction.guild.id, toUpdate)
+ await client.database.guilds.write(interaction.guild.id, toUpdate)
} catch (e) {
return interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets")
.setDescription(`Something went wrong and the staff notifications channel could not be set`)
.setStatus("Danger")
@@ -129,7 +129,7 @@
}
} else {
return interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets")
.setDescription(`No changes were made`)
.setStatus("Success")
@@ -138,7 +138,7 @@
});
}
}
- let data = await client.database.read(interaction.guild.id);
+ let data = await client.database.guilds.read(interaction.guild.id);
data.tickets.customTypes = data.tickets.customTypes.filter((v, i, a) => a.indexOf(v) === i)
let lastClicked = "";
let embed;
@@ -152,7 +152,7 @@
customTypes: data.tickets.customTypes
}
while (true) {
- embed = new generateEmojiEmbed()
+ embed = new EmojiEmbed()
.setTitle("Tickets")
.setDescription(
`${data.enabled ? "" : getEmojiByName("TICKETS.REPORT")} **Enabled:** ${data.enabled ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`}\n` +
@@ -206,23 +206,23 @@
if (i.component.customId == "clearCategory") {
if (lastClicked == "cat") {
lastClicked = "";
- await client.database.write(interaction.guild.id, {}, ["tickets.category"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["tickets.category"])
data.category = undefined;
} else lastClicked = "cat";
} else if (i.component.customId == "clearMaxTickets") {
if (lastClicked == "max") {
lastClicked = "";
- await client.database.write(interaction.guild.id, {}, ["tickets.maxTickets"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["tickets.maxTickets"])
data.maxTickets = 5;
} else lastClicked = "max";
} else if (i.component.customId == "clearSupportPing") {
if (lastClicked == "sup") {
lastClicked = "";
- await client.database.write(interaction.guild.id, {}, ["tickets.supportRole"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["tickets.supportRole"])
data.supportRole = undefined;
} else lastClicked = "sup";
} else if (i.component.customId == "enabled") {
- await client.database.write(interaction.guild.id, { "tickets.enabled": !data.enabled })
+ await client.database.guilds.write(interaction.guild.id, { "tickets.enabled": !data.enabled })
data.enabled = !data.enabled;
} else if (i.component.customId == "manageTypes") {
data = await manageTypes(interaction, data, m);
@@ -238,7 +238,7 @@
if (data.useCustom) {
let customTypes = data.customTypes;
await interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Types")
.setDescription(
"**Custom types enabled**\n\n" +
@@ -299,7 +299,7 @@
.setPlaceholder("Select types to use")
])
await interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Types")
.setDescription(
"**Default types enabled**\n\n" +
@@ -331,7 +331,7 @@
if (i.component.customId == "types") {
i.deferUpdate()
let types = toHexInteger(i.values, ticketTypes);
- await client.database.write(interaction.guild.id, { "tickets.types": types })
+ await client.database.guilds.write(interaction.guild.id, { "tickets.types": types })
data.types = types;
} else if (i.component.customId == "removeTypes") {
i.deferUpdate()
@@ -340,7 +340,7 @@
if (customTypes) {
customTypes = customTypes.filter((t) => !types.includes(t));
customTypes = customTypes.length > 0 ? customTypes : null;
- await client.database.write(interaction.guild.id, { "tickets.customTypes": customTypes })
+ await client.database.guilds.write(interaction.guild.id, { "tickets.customTypes": customTypes })
data.customTypes = customTypes;
}
} else if (i.component.customId == "addType") {
@@ -357,7 +357,7 @@
)
))
await interaction.editReply({
- embeds: [new generateEmojiEmbed()
+ embeds: [new EmojiEmbed()
.setTitle("Tickets > Types")
.setDescription("Modal opened. If you can't see it, click back and try again.")
.setStatus("Success")
@@ -369,15 +369,16 @@
.setCustomId("back")
])]
});
- let out
+ let out;
try {
out = await modalInteractionCollector(m, (m) => m.channel.id == interaction.channel.id, (m) => m.customId == "addType")
} catch (e) { continue }
if (out.fields) {
let toAdd = out.fields.getTextInputValue("type");
if (!toAdd) { continue }
+ toAdd = toAdd.substring(0, 80)
try {
- await client.database.append(interaction.guild.id, "tickets.customTypes", toAdd)
+ await client.database.guilds.append(interaction.guild.id, "tickets.customTypes", toAdd)
} catch { continue }
data.customTypes = data.customTypes || [];
if (!data.customTypes.includes(toAdd)) {
@@ -386,11 +387,11 @@
} else { continue }
} else if (i.component.customId == "switchToDefault") {
i.deferUpdate()
- await client.database.write(interaction.guild.id, { "tickets.useCustom": false }, [])
+ await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": false }, [])
data.useCustom = false;
} else if (i.component.customId == "switchToCustom") {
i.deferUpdate()
- await client.database.write(interaction.guild.id, { "tickets.useCustom": true }, [])
+ await client.database.guilds.write(interaction.guild.id, { "tickets.useCustom": true }, [])
data.useCustom = true;
} else {
i.deferUpdate()
diff --git a/src/commands/settings/verify/role.ts b/src/commands/settings/verify/role.ts
index 68b4bf9..44406e9 100644
--- a/src/commands/settings/verify/role.ts
+++ b/src/commands/settings/verify/role.ts
@@ -1,5 +1,5 @@
import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
-import generateEmojiEmbed from "../../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -14,7 +14,7 @@
const callback = async (interaction: CommandInteraction): Promise<any> => {
let m;
- m = await interaction.reply({embeds: [new generateEmojiEmbed()
+ m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Loading")
.setStatus("Danger")
.setEmoji("NUCLEUS.LOADING")
@@ -24,7 +24,7 @@
try {
role = interaction.options.getRole("role")
} catch {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Verify Role")
.setDescription("The role you provided is not a valid role")
@@ -33,7 +33,7 @@
}
role = role as Discord.Role
if (role.guild.id != interaction.guild.id) {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(`You must choose a role in this server`)
.setStatus("Danger")
@@ -49,10 +49,10 @@
.send(true)
if (confirmation.success) {
try {
- await client.database.write(interaction.guild.id, {"verify.role": role.id, "verify.enabled": true});
+ await client.database.guilds.write(interaction.guild.id, {"verify.role": role.id, "verify.enabled": true});
} catch (e) {
console.log(e)
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(`Something went wrong while setting the verify role`)
.setStatus("Danger")
@@ -60,7 +60,7 @@
], components: []});
}
} else {
- return interaction.editReply({embeds: [new generateEmojiEmbed()
+ return interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(`No changes were made`)
.setStatus("Success")
@@ -69,10 +69,10 @@
}
}
let clicks = 0;
- let data = await client.database.read(interaction.guild.id);
+ let data = await client.database.guilds.read(interaction.guild.id);
let role = data.verify.role;
while (true) {
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(role ? `Your verify role is currently set to <@&${role}>` : `You have not set a verify role`)
.setStatus("Success")
@@ -93,14 +93,14 @@
clicks += 1;
if (clicks == 2) {
clicks = 0;
- await client.database.write(interaction.guild.id, {}, ["verify.role", "verify.enabled"])
+ await client.database.guilds.write(interaction.guild.id, {}, ["verify.role", "verify.enabled"])
role = undefined;
}
} else {
break
}
}
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Verify Role")
.setDescription(role ? `Your verify role is currently set to <@&${role}}>` : `You have not set a verify role`)
.setStatus("Success")