Still got errors and warnings, mostly the same and easy to fix
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 55697b9..d5d7bb8 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -2,50 +2,50 @@
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import { PasteClient, Publicity, ExpireDate } from "pastebin-api";
-import config from '../config/main.json' assert {type: 'json'};
+import config from "../config/main.json" assert {type: "json"};
import client from "../utils/client.js";
-const pbClient = new PasteClient(config.pastebinApiKey)
+const pbClient = new PasteClient(config.pastebinApiKey);
export default async function (interaction) {
- const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger
+ const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
- let messages = []
+ let messages = [];
let deleted = 100;
while (deleted === 100) {
let fetched;
await (interaction.channel as TextChannel).messages.fetch({limit: 100}).then(async (ms) => {
fetched = await (interaction.channel as TextChannel).bulkDelete(ms, true);
- })
- deleted = fetched.size
+ });
+ deleted = fetched.size;
if (fetched) {
- messages = messages.concat(fetched.map(m => m))
+ messages = messages.concat(fetched.map(m => m));
}
}
- let out = ""
+ let out = "";
messages.reverse().forEach(message => {
if (!message.author.bot) {
- let sentDate = new Date(message.createdTimestamp)
- out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${sentDate.toUTCString()}]\n`
- let lines = message.content.split("\n")
- lines.forEach(line => {out += `> ${line}\n`})
- out += `\n\n`
+ const sentDate = new Date(message.createdTimestamp);
+ out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${sentDate.toUTCString()}]\n`;
+ const lines = message.content.split("\n");
+ lines.forEach(line => {out += `> ${line}\n`;});
+ out += "\n\n";
}
- })
- let member = interaction.channel.guild.members.cache.get(interaction.channel.topic.split(" ")[0])
+ });
+ const member = interaction.channel.guild.members.cache.get(interaction.channel.topic.split(" ")[0]);
let m;
if (out !== "") {
const url = await pbClient.createPaste({
code: out,
expireDate: ExpireDate.Never,
name: `Ticket Transcript for ${member.user.username}#${member.user.discriminator} (Created at ${new Date(interaction.channel.createdTimestamp).toDateString()})`,
- publicity: Publicity.Unlisted,
- })
- let guildConfig = await client.database.guilds.read(interaction.guild.id);
+ publicity: Publicity.Unlisted
+ });
+ const guildConfig = await client.database.guilds.read(interaction.guild.id);
m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Transcript")
- .setDescription(`You can view the transcript using the link below. You can save the link for later` + (guildConfig.logging.logs.channel ?
+ .setDescription("You can view the transcript using the link below. You can save the link for later" + (guildConfig.logging.logs.channel ?
` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
: "."))
.setStatus("Success")
@@ -64,7 +64,7 @@
} else {
m = await interaction.reply({embeds: [new EmojiEmbed()
.setTitle("Transcript")
- .setDescription(`The transcript was empty, so no changes were made. To delete this ticket, press the delete button below.`)
+ .setDescription("The transcript was empty, so no changes were made. To delete this ticket, press the delete button below.")
.setStatus("Success")
.setEmoji("CONTROL.DOWNLOAD")
], components: [new MessageActionRow().addComponents([
@@ -78,15 +78,15 @@
let i;
try {
i = await m.awaitMessageComponent({ time: 300000 });
- i.deferUpdate()
- } catch (e) { }
- let data = {
+ i.deferUpdate();
+ } catch { return; }
+ const data = {
meta:{
- type: 'ticketDeleted',
- displayName: 'Ticket Deleted',
+ type: "ticketDeleted",
+ displayName: "Ticket Deleted",
calculateType: "ticketUpdate",
color: NucleusColors.red,
- emoji: 'GUILD.TICKET.CLOSE',
+ emoji: "GUILD.TICKET.CLOSE",
timestamp: new Date().getTime()
},
list: {
@@ -97,8 +97,8 @@
hidden: {
guild: interaction.guild.id
}
- }
+ };
log(data);
- await interaction.channel.delete()
- return
+ await interaction.channel.delete();
+ return;
}
\ No newline at end of file