Fix a bunch of linter errors
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index d5d7bb8..3d7f4c6 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -2,86 +2,125 @@
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);
export default async function (interaction) {
- const { log, NucleusColors, entry, renderUser, renderDelta } = client.logger;
+ const { log, NucleusColors, entry, renderUser, renderDelta } =
+ client.logger;
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);
- });
+ await (interaction.channel as TextChannel).messages
+ .fetch({ limit: 100 })
+ .then(async (ms) => {
+ fetched = await (interaction.channel as TextChannel).bulkDelete(
+ ms,
+ true
+ );
+ });
deleted = fetched.size;
if (fetched) {
- messages = messages.concat(fetched.map(m => m));
+ messages = messages.concat(fetched.map((m) => m));
}
}
let out = "";
- messages.reverse().forEach(message => {
+ messages.reverse().forEach((message) => {
if (!message.author.bot) {
const sentDate = new Date(message.createdTimestamp);
- out += `${message.author.username}#${message.author.discriminator} (${message.author.id}) [${sentDate.toUTCString()}]\n`;
+ 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`;});
+ lines.forEach((line) => {
+ out += `> ${line}\n`;
+ });
out += "\n\n";
}
});
- const 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()})`,
+ name: `Ticket Transcript for ${member.user.username}#${
+ member.user.discriminator
+ } (Created at ${new Date(
+ interaction.channel.createdTimestamp
+ ).toDateString()})`,
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 ?
- ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
- : "."))
- .setStatus("Success")
- .setEmoji("CONTROL.DOWNLOAD")
- ], components: [new MessageActionRow().addComponents([
- new MessageButton()
- .setLabel("View")
- .setStyle("LINK")
- .setURL(url),
- new MessageButton()
- .setLabel("Delete")
- .setStyle("DANGER")
- .setCustomId("close")
- .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- ])], fetchReply: true});
+ 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
+ ? ` or find it in <#${guildConfig.logging.logs.channel}> once you press delete below. After this the channel will be deleted.`
+ : ".")
+ )
+ .setStatus("Success")
+ .setEmoji("CONTROL.DOWNLOAD")
+ ],
+ components: [
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("View")
+ .setStyle("LINK")
+ .setURL(url),
+ new MessageButton()
+ .setLabel("Delete")
+ .setStyle("DANGER")
+ .setCustomId("close")
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+ ])
+ ],
+ fetchReply: true
+ });
} 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.")
- .setStatus("Success")
- .setEmoji("CONTROL.DOWNLOAD")
- ], components: [new MessageActionRow().addComponents([
- new MessageButton()
- .setLabel("Delete")
- .setStyle("DANGER")
- .setCustomId("close")
- .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- ])], fetchReply: true});
+ 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."
+ )
+ .setStatus("Success")
+ .setEmoji("CONTROL.DOWNLOAD")
+ ],
+ components: [
+ new MessageActionRow().addComponents([
+ new MessageButton()
+ .setLabel("Delete")
+ .setStyle("DANGER")
+ .setCustomId("close")
+ .setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
+ ])
+ ],
+ fetchReply: true
+ });
}
let i;
try {
i = await m.awaitMessageComponent({ time: 300000 });
i.deferUpdate();
- } catch { return; }
+ } catch {
+ return;
+ }
const data = {
- meta:{
+ meta: {
type: "ticketDeleted",
displayName: "Ticket Deleted",
calculateType: "ticketUpdate",
@@ -90,9 +129,24 @@
timestamp: new Date().getTime()
},
list: {
- ticketFor: entry(interaction.channel.topic.split(" ")[0], renderUser((await interaction.guild.members.fetch(interaction.channel.topic.split(" ")[0])).user)),
- deletedBy: entry(interaction.member.user.id, renderUser(interaction.member.user)),
- deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+ ticketFor: entry(
+ interaction.channel.topic.split(" ")[0],
+ renderUser(
+ (
+ await interaction.guild.members.fetch(
+ interaction.channel.topic.split(" ")[0]
+ )
+ ).user
+ )
+ ),
+ deletedBy: entry(
+ interaction.member.user.id,
+ renderUser(interaction.member.user)
+ ),
+ deleted: entry(
+ new Date().getTime(),
+ renderDelta(new Date().getTime())
+ )
},
hidden: {
guild: interaction.guild.id
@@ -101,4 +155,4 @@
log(data);
await interaction.channel.delete();
return;
-}
\ No newline at end of file
+}