mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
log errored guild name and fix tickets embed random error
This commit is contained in:
parent
4728258071
commit
e50c36a967
2 changed files with 9 additions and 8 deletions
|
@ -33,14 +33,13 @@ class CreateTicketEmbed extends BaseCommand {
|
||||||
interaction.data = [];
|
interaction.data = [];
|
||||||
interaction.data.guild = await client.getGuildData(interaction.guildId);
|
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;
|
const button = interaction.component;
|
||||||
|
|
||||||
if (button.customId === "support_ticket") {
|
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) {
|
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);
|
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) => {
|
collector.on("end", async (_, reason) => {
|
||||||
if (reason !== "canceled") {
|
if (reason !== "canceled") {
|
||||||
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot);
|
const reversedMessages = (await interaction.channel.messages.fetch()).filter(m => !m.author.bot),
|
||||||
const messages = Array.from(reversedMessages.values()).reverse();
|
messages = Array.from(reversedMessages.values()).reverse(),
|
||||||
|
transcriptionLogs = interaction.data.guild.plugins.tickets.transcriptionLogs,
|
||||||
|
ticketLogs = interaction.data.guild.plugins.tickets.ticketLogs;
|
||||||
|
|
||||||
if (messages.length > 1) {
|
if (messages.length > 1) {
|
||||||
let transcript = "---- TICKET CREATED ----\n";
|
let transcript = "---- TICKET CREATED ----\n";
|
||||||
|
|
|
@ -56,7 +56,7 @@ module.exports.init = async client => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} 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;
|
else throw err;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue