log errored guild name and fix tickets embed random error

This commit is contained in:
Jonny_Bro (Nikita) 2024-07-10 21:39:32 +05:00
parent 4728258071
commit e50c36a967
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8
2 changed files with 9 additions and 8 deletions

View file

@ -33,14 +33,13 @@ class CreateTicketEmbed extends BaseCommand {
interaction.data = [];
interaction.data.guild = await client.getGuildData(interaction.guildId);
const guildData = interaction.data.guild,
ticketsCategory = guildData.plugins?.tickets?.ticketsCategory,
ticketLogs = guildData.plugins?.tickets?.ticketLogs,
transcriptionLogs = guildData.plugins?.tickets?.transcriptionLogs;
const button = interaction.component;
if (button.customId === "support_ticket") {
const guildData = interaction.data.guild,
ticketsCategory = guildData.plugins.tickets.ticketsCategory,
ticketLogs = guildData.plugins.tickets.ticketLogs;
if (interaction.guild.channels.cache.get(ticketsCategory).children.cache.size >= 50) {
const sorted = interaction.guild.channels.cache.get(ticketsCategory).children.cache.sort((ch1, ch2) => ch1.createdTimestamp - ch2.createdTimestamp);
@ -137,8 +136,10 @@ class CreateTicketEmbed extends BaseCommand {
collector.on("end", async (_, reason) => {
if (reason !== "canceled") {
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
const messages = Array.from(reversedMessages.values()).reverse();
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot),
messages = Array.from(reversedMessages.values()).reverse(),
transcriptionLogs = interaction.data.guild.plugins.tickets.transcriptionLogs,
ticketLogs = interaction.data.guild.plugins.tickets.ticketLogs;
if (messages.length > 1) {
let transcript = "---- TICKET CREATED ----\n";

View file

@ -56,7 +56,7 @@ module.exports.init = async client => {
});
}
} catch (err) {
if (err.code === 10003) console.log("Unknown channel");
if (err.code === 10003) console.log(`No channel found for ${guild.name}`);
else throw err;
}
});