huge changes once again
diff --git a/src/automations/tickets/create.ts b/src/automations/tickets/create.ts
index 06e7e07..8eee3b2 100644
--- a/src/automations/tickets/create.ts
+++ b/src/automations/tickets/create.ts
@@ -1,7 +1,7 @@
import Discord, { MessageActionRow, MessageButton } from "discord.js";
import { tickets, toHexArray } from "../../utils/calculate.js";
import client from "../../utils/client.js";
-import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
function capitalize(s: string) {
@@ -12,9 +12,9 @@
export default async function (interaction) {
const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
- let config = await client.database.read(interaction.guild.id);
+ let config = await client.database.guilds.read(interaction.guild.id);
if (!config.tickets.enabled || !config.tickets.category) {
- return await interaction.reply({embeds: [new generateEmojiEmbed()
+ return await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Tickets are disabled")
.setDescription("Please enable tickets in the configuration to use this command.")
.setStatus("Danger")
@@ -32,7 +32,7 @@
}
});
if (count >= config.tickets.maxTickets) {
- return await interaction.reply({embeds: [new generateEmojiEmbed()
+ return await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setDescription(`You have reached the maximum amount of tickets (${config.tickets.maxTickets}). Please close one of your active tickets before creating a new one.`)
.setStatus("Danger")
@@ -41,7 +41,7 @@
}
let ticketTypes;
let custom = false
- if (config.tickets.customTypes) { ticketTypes = config.tickets.customTypes; custom = true }
+ if (config.tickets.customTypes && config.tickets.useCustom) { ticketTypes = config.tickets.customTypes; custom = true }
else if (config.tickets.types) ticketTypes = toHexArray(config.tickets.types, tickets);
else ticketTypes = [];
let chosenType;
@@ -65,7 +65,7 @@
for (let i = 0; i < formattedTicketTypes.length; i += 5) {
splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
}
- let m = await interaction.reply({embeds: [new generateEmojiEmbed()
+ let m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setDescription("Select a ticket type")
.setStatus("Success")
@@ -99,7 +99,7 @@
for (let i = 0; i < formattedTicketTypes.length; i += 5) {
splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
}
- component.update({embeds: [new generateEmojiEmbed()
+ component.update({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setDescription("Select a ticket type")
.setStatus("Success")
@@ -107,7 +107,7 @@
], components: splitFormattedTicketTypes});
} else {
chosenType = null
- await interaction.reply({embeds: [new generateEmojiEmbed()
+ await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setEmoji("GUILD.TICKET.OPEN")
], ephemeral: true, components: splitFormattedTicketTypes})
@@ -141,7 +141,7 @@
reason: "Creating ticket"
})
} catch (e) {
- return await interaction.editReply({embeds: [new generateEmojiEmbed()
+ return await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setDescription("Failed to create ticket")
.setStatus("Danger")
@@ -161,7 +161,7 @@
let content = interaction.options ? interaction.options.getString("message") || "" : "";
if (content) content = `**Message:**\n> ${content}\n`;
let emoji = custom ? "" : getEmojiByName("TICKETS." + chosenType.toUpperCase());
- await c.send({ embeds: [new generateEmojiEmbed()
+ await c.send({ embeds: [new EmojiEmbed()
.setTitle("New Ticket")
.setDescription(
`Ticket created by <@${interaction.member.user.id}>\n` +
@@ -195,9 +195,9 @@
guild: interaction.guild.id
}
}
- log(data, client);
+ log(data);
} catch (e) { console.log(e)}
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Create Ticket")
.setDescription(`Ticket created. You can view it here: <#${c.id}>`)
.setStatus("Success")
diff --git a/src/automations/tickets/delete.ts b/src/automations/tickets/delete.ts
index a974b2e..3df284b 100644
--- a/src/automations/tickets/delete.ts
+++ b/src/automations/tickets/delete.ts
@@ -1,18 +1,18 @@
import Discord, { MessageButton, MessageActionRow } from "discord.js";
import client from "../../utils/client.js";
-import generateEmojiEmbed from "../../utils/generateEmojiEmbed.js";
+import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
export default async function (interaction) {
// @ts-ignore
const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
- let config = await client.database.read(interaction.guild.id);
+ let config = await client.database.guilds.read(interaction.guild.id);
let thread = false; let threadChannel
if (interaction.channel instanceof Discord.ThreadChannel) thread = true; threadChannel = interaction.channel as Discord.ThreadChannel
let channel = (interaction.channel as Discord.TextChannel)
if (!channel.parent || config.tickets.category != channel.parent.id || (thread ? (threadChannel.parent.parent.id != config.tickets.category) : false)) {
- return interaction.reply({embeds: [new generateEmojiEmbed()
+ return interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Deleting Ticket...")
.setDescription("This ticket is not in your tickets category, so cannot be deleted. You cannot run close in a thread.")
.setStatus("Danger")
@@ -21,7 +21,7 @@
}
let status = channel.topic.split(" ")[1];
if (status == "Archived") {
- await interaction.reply({embeds: [new generateEmojiEmbed()
+ await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Delete Ticket")
.setDescription("Your ticket is being deleted...")
.setStatus("Danger")
@@ -45,11 +45,11 @@
guild: interaction.guild.id
}
}
- log(data, client);
+ log(data);
interaction.channel.delete();
return;
} else if (status == "Active") {
- await interaction.reply({embeds: [new generateEmojiEmbed()
+ await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Close Ticket")
.setDescription("Your ticket is being closed...")
.setStatus("Warning")
@@ -95,8 +95,8 @@
guild: interaction.guild.id
}
}
- log(data, client);
- await interaction.editReply({embeds: [new generateEmojiEmbed()
+ log(data);
+ await interaction.editReply({embeds: [new EmojiEmbed()
.setTitle("Close Ticket")
.setDescription("This ticket has been closed.\nType `/ticket close` again to delete it.")
.setStatus("Warning")
@@ -112,7 +112,7 @@
}
async function purgeByUser(member, guild) {
- let config = await client.database.read(guild.id);
+ let config = await client.database.guilds.read(guild.id);
if (!config.tickets.category) return;
let tickets = guild.channels.cache.get(config.tickets.category);
if (!tickets) return;
@@ -147,7 +147,7 @@
guild: guild.id
}
}
- log(data, member.client);
+ log(data);
} catch {}
}
}