diff --git a/src/artigen/managers/handler/workerComplete.ts b/src/artigen/managers/handler/workerComplete.ts index 059b23c..7f3302c 100644 --- a/src/artigen/managers/handler/workerComplete.ts +++ b/src/artigen/managers/handler/workerComplete.ts @@ -78,30 +78,32 @@ export const onWorkerComplete = async (workerMessage: MessageEvent, if (!apiErroredOut) { // And message the full details to each of the GMs, alerting roller of every GM that could not be messaged rollRequest.modifiers.gms.forEach(async (gm) => { - log(LT.LOG, `Messaging GM ${gm}`); + const gmId: bigint = BigInt(gm.startsWith('<') ? gm.substring(2, gm.length - 1) : gm); + log(LT.LOG, `Messaging GM ${gm} | ${gmId}`); // Attempt to DM the GM and send a warning if it could not DM a GM - await sendDirectMessage(BigInt(gm.substring(2, gm.length - 1)), { + await sendDirectMessage(gmId, { + content: `Original GM Roll Request: ${rollRequest.apiRoll ? newMsg && newMsg.link : rollRequest.dd.myResponse.link}`, embeds: rollRequest.modifiers.count ? [gmEmbedDetails.embed, countEmbed] : [gmEmbedDetails.embed], }) .then(async () => { // Check if we need to attach a file and send it after the initial details sent if (gmEmbedDetails.hasAttachment) { - await sendDirectMessage(BigInt(gm.substring(2, gm.length - 1)), { + await sendDirectMessage(gmId, { file: gmEmbedDetails.attachment, }).catch(() => { if (newMsg && rollRequest.apiRoll) { - newMsg.reply(generateDMFailed(gm)); + newMsg.reply(generateDMFailed(gmId)); } else if (!rollRequest.apiRoll) { - rollRequest.dd.originalMessage.reply(generateDMFailed(gm)); + rollRequest.dd.originalMessage.reply(generateDMFailed(gmId)); } }); } }) .catch(() => { if (rollRequest.apiRoll && newMsg) { - newMsg.reply(generateDMFailed(gm)); + newMsg.reply(generateDMFailed(gmId)); } else if (!rollRequest.apiRoll) { - rollRequest.dd.originalMessage.reply(generateDMFailed(gm)); + rollRequest.dd.originalMessage.reply(generateDMFailed(gmId)); } }); }); diff --git a/src/commandUtils.ts b/src/commandUtils.ts index 77681c5..739059c 100644 --- a/src/commandUtils.ts +++ b/src/commandUtils.ts @@ -123,11 +123,11 @@ export const generateApiSuccess = (args: string) => ({ ], }); -export const generateDMFailed = (user: string) => ({ +export const generateDMFailed = (user: bigint) => ({ embeds: [ { color: failColor, - title: `WARNING: ${user} could not be messaged.`, + title: `WARNING: <@${user}> could not be messaged.`, description: 'If this issue persists, make sure direct messages are allowed from this server.', }, ], @@ -274,7 +274,11 @@ export const generateRollEmbed = async (authorId: bigint, returnDetails: SolvedR return { embed: { color: infoColor2, - description: `<@${authorId}>${returnDetails.line1}\n\nResults have been messaged to the following GMs: ${modifiers.gms.join(' ')}`, + description: `<@${authorId}>${returnDetails.line1}\n\nResults have been messaged to the following GMs: ${ + modifiers.gms + .map((gm) => (gm.startsWith('<') ? gm : `<@${gm}>`)) + .join(' ') + }`, }, hasAttachment: false, attachment: {