fixed rolemenu/tracks buttons & stats
diff --git a/src/utils/database.ts b/src/utils/database.ts
index a5d5149..75a79d9 100644
--- a/src/utils/database.ts
+++ b/src/utils/database.ts
@@ -221,7 +221,7 @@
interface findDocSchema {
channelID: string;
messageID: string;
- transcript: string;
+ code: string;
}
export class Transcript {
@@ -284,16 +284,20 @@
async deleteAll(guild: string) {
// console.log("Transcript delete")
const filteredDocs = await this.transcripts.find({ guild: guild }).toArray();
+ const filteredDocs1 = await this.messageToTranscript.find({ guild: guild }).toArray();
for (const doc of filteredDocs) {
await this.transcripts.deleteOne({ code: doc.code });
}
+ for (const doc of filteredDocs1) {
+ await this.messageToTranscript.deleteOne({ code: doc.code });
+ }
}
async readEncrypted(code: string) {
// console.log("Transcript read")
let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
let findDoc: findDocSchema | null = null;
- if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
+ if (!doc) findDoc = await this.messageToTranscript.findOne({ code: code });
if (findDoc) {
const message = await (
client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
@@ -330,7 +334,7 @@
let doc: TranscriptSchema | null = await this.transcripts.findOne({ code: code });
let findDoc: findDocSchema | null = null;
console.log(doc);
- if (!doc) findDoc = await this.messageToTranscript.findOne({ transcript: code });
+ if (!doc) findDoc = await this.messageToTranscript.findOne({ code: code });
if (findDoc) {
const message = await (
client.channels.cache.get(findDoc.channelID) as Discord.TextBasedChannel | null
@@ -412,7 +416,7 @@
topRole: {
color: message.member ? message.member.roles.highest.color : 0x000000
},
- iconURL: (message.member?.user || message.author).displayAvatarURL({ forceStatic: true }),
+ iconURL: (message.member?.user ?? message.author).displayAvatarURL({ forceStatic: true }),
bot: message.author.bot || false
},
createdTimestamp: message.createdTimestamp
diff --git a/src/utils/eventScheduler.ts b/src/utils/eventScheduler.ts
index 2ef5fb4..34bb28e 100644
--- a/src/utils/eventScheduler.ts
+++ b/src/utils/eventScheduler.ts
@@ -40,7 +40,7 @@
await client.database.transcripts.upload({
channelID: channel.id,
messageID: m.id,
- transcript: job.attrs.data.transcript
+ code: job.attrs.data.transcript
});
await job.remove();
});