Performance testing
diff --git a/src/premium/attachmentLogs.ts b/src/premium/attachmentLogs.ts
index 0c491b7..abda27d 100644
--- a/src/premium/attachmentLogs.ts
+++ b/src/premium/attachmentLogs.ts
@@ -4,7 +4,7 @@
import { saveAttachment } from "../reflex/scanners.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import addPlural from "../utils/plurals.js";
-import type { Message } from "discord.js";
+import type { GuildTextBasedChannel, Message } from "discord.js";
export default async function logAttachment(message: Message): Promise<AttachmentLogSchema> {
if (!message.guild) throw new Error("Tried to log an attachment in a non-guild message");
@@ -31,7 +31,7 @@
}
}
if (attachments.length === 0) return { files: [] };
- if (client.database.premium.hasPremium(message.guild.id)) {
+ if (await client.database.premium.hasPremium(message.guild.id)) {
const channel = (await client.database.guilds.read(message.guild.id)).logging.attachments.channel;
if (!channel) {
singleNotify(
@@ -52,7 +52,7 @@
);
return { files: attachments };
}
- const m = await channelObj.send({
+ const m = await (channelObj as GuildTextBasedChannel).send({
embeds: [
new EmojiEmbed()
.setTitle(`${addPlural(attachments.length, "Attachment")} Sent`)
@@ -60,8 +60,8 @@
keyValueList({
messageId: `\`${message.id}\``,
sentBy: renderUser(message.author),
- sentIn: renderChannel(message.channel),
- sent: renderDelta(new Date(message.createdTimestamp))
+ sentIn: renderChannel(message.channel as GuildTextBasedChannel),
+ sent: renderDelta((new Date(message.createdTimestamp)).getTime())
}) + `\n[[Jump to message]](${message.url})`
)
.setEmoji("ICONS.ATTACHMENT")
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 6805017..e755b83 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -6,7 +6,8 @@
ButtonBuilder,
MessageComponentInteraction,
TextChannel,
- ButtonStyle
+ ButtonStyle,
+ User
} from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
@@ -76,7 +77,7 @@
.setEmoji("CONTROL.DOWNLOAD")
],
components: [
- new ActionRowBuilder().addComponents([
+ new ActionRowBuilder<ButtonBuilder>().addComponents([
new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(url),
new ButtonBuilder()
.setLabel("Delete")
@@ -99,7 +100,7 @@
.setEmoji("CONTROL.DOWNLOAD")
],
components: [
- new ActionRowBuilder().addComponents([
+ new ActionRowBuilder<ButtonBuilder>().addComponents([
new ButtonBuilder()
.setLabel("Delete")
.setStyle(ButtonStyle.Danger)
@@ -128,8 +129,8 @@
},
list: {
ticketFor: member ? entry(member.id, renderUser(member.user)) : entry(null, "*Unknown*"),
- deletedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user)),
- deleted: entry(new Date().getTime(), renderDelta(new Date().getTime()))
+ deletedBy: entry(interaction.member!.user.id, renderUser(interaction.member!.user as User)),
+ deleted: entry(new Date().getTime().toString(), renderDelta(new Date().getTime()))
},
hidden: {
guild: interaction.guild!.id