From 277e509f260ffba1dfbbf2bab638f704e932aac4 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 23 Mar 2022 22:46:42 +0200 Subject: [PATCH] added channel ID --- structure/commands/MessageIds.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/structure/commands/MessageIds.js b/structure/commands/MessageIds.js index f790749..8d0ff62 100644 --- a/structure/commands/MessageIds.js +++ b/structure/commands/MessageIds.js @@ -21,6 +21,7 @@ class MessageIds extends Command { const [ userId ] = result; const user = await this.client.users.fetch(userId); + const dmChannel = await user.createDM(); const history = await this.client.cache.loadModmailHistory(userId); const sorted = history.sort((a, b) => b.timestamp - a.timestamp); @@ -28,14 +29,13 @@ class MessageIds extends Command { for (const mm of sorted) { if (!mm.msgid && !mm.isReply) break; // Old modmails from before msg id logging -- could probably supplement with fetching messages but cba rn - idContentPairs.push(`${mm.msgid} - ${mm.content}`); - + idContentPairs.push(`${dmChannel.id}/${mm.msgid} - ${mm.content}`); } if (!idContentPairs.length) { - const msgs = await user.createDM().then(dm => dm.messages.fetch()); + const msgs = await dmChannel.messages.fetch(); const sortedMsgs = msgs.filter(msg => msg.author.id !== this.client.user.id).sort((a, b) => b.createdTimestamp - a.createdTimestamp); - for (const msg of sortedMsgs.values()) idContentPairs.push(`${msg.id} - ${msg.content}`); + for (const msg of sortedMsgs.values()) idContentPairs.push(`${dmChannel.id}/${msg.id} - ${msg.content}`); } await message.channel.send({