complete url

This commit is contained in:
Erik 2022-03-23 22:48:43 +02:00
parent 277e509f26
commit dfb0c794ba
No known key found for this signature in database
GPG Key ID: FEFF4B220DDF5589

View File

@ -26,16 +26,17 @@ class MessageIds extends Command {
const history = await this.client.cache.loadModmailHistory(userId); const history = await this.client.cache.loadModmailHistory(userId);
const sorted = history.sort((a, b) => b.timestamp - a.timestamp); const sorted = history.sort((a, b) => b.timestamp - a.timestamp);
const idContentPairs = []; const idContentPairs = [];
const urlBase = `https://discord.com/channels/@me`;
for (const mm of sorted) { 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 if (!mm.msgid && !mm.isReply) break; // Old modmails from before msg id logging -- could probably supplement with fetching messages but cba rn
idContentPairs.push(`${dmChannel.id}/${mm.msgid} - ${mm.content}`); idContentPairs.push(`${urlBase}/${dmChannel.id}/${mm.msgid} - ${mm.content}`);
} }
if (!idContentPairs.length) { if (!idContentPairs.length) {
const msgs = await dmChannel.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); 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(`${dmChannel.id}/${msg.id} - ${msg.content}`); for (const msg of sortedMsgs.values()) idContentPairs.push(`${urlBase}/${dmChannel.id}/${msg.id} - ${msg.content}`);
} }
await message.channel.send({ await message.channel.send({