From 15e8f847c516a2626115268b9d9b8a78ee30e960 Mon Sep 17 00:00:00 2001 From: "Ean Milligan (Bastion)" Date: Fri, 6 May 2022 00:10:21 -0400 Subject: [PATCH] Add super no details decorator --- README.md | 1 + src/commands/roll.ts | 10 ++++++---- src/commands/roll/getModifiers.ts | 7 +++++++ src/constantCmds.ts | 4 ++++ src/mod.d.ts | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 50813f1..909cea7 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ The Artificer comes with a few supplemental commands to the main rolling command * `[[((d20+20) - 10) / 5]]` will roll a d20, add 20 to that roll, subtract off 10, and finally divide by 5. * This command also has some useful decorators that can used. These decorators simply need to be placed after all rolls in the message: * `-nd` - No Details - Suppresses all details of the requested roll + * `-snd` - Super No Details - Suppresses all details of the requested roll and hides no details message * `-s` - Spoiler - Spoilers all details of the requested roll * `-m` - Maximize Roll - Rolls the theoretical maximum roll, cannot be used with -n * `-n` - Nominal Roll - Rolls the theoretical nominal roll, cannot be used with -m diff --git a/src/commands/roll.ts b/src/commands/roll.ts index 9e1ebf2..7aaf627 100644 --- a/src/commands/roll.ts +++ b/src/commands/roll.ts @@ -62,10 +62,12 @@ export const roll = async (message: DiscordenoMessage, args: string[], command: // Else format the output using details from the solver returnText = `<@${message.authorId}>${returnmsg.line1}\n${returnmsg.line2}`; - if (modifiers.noDetails) { - returnText += "\nDetails suppressed by -nd flag."; - } else { - returnText += `\nDetails:\n${modifiers.spoiler}${returnmsg.line3}${modifiers.spoiler}`; + if (!modifiers.superNoDetails) { + if (modifiers.noDetails) { + returnText += "\nDetails suppressed by -nd flag."; + } else { + returnText += `\nDetails:\n${modifiers.spoiler}${returnmsg.line3}${modifiers.spoiler}`; + } } } diff --git a/src/commands/roll/getModifiers.ts b/src/commands/roll/getModifiers.ts index 1fc6d7c..3b15f4d 100644 --- a/src/commands/roll/getModifiers.ts +++ b/src/commands/roll/getModifiers.ts @@ -15,6 +15,7 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri const errorType = "Modifiers invalid:"; const modifiers: RollModifiers = { noDetails: false, + superNoDetails: false, spoiler: "", maxRoll: false, nominalRoll: false, @@ -31,6 +32,12 @@ export const getModifiers = (m: DiscordenoMessage, args: string[], command: stri case "-nd": modifiers.noDetails = true; + args.splice(i, 1); + i--; + break; + case "-snd": + modifiers.superNoDetails = true; + args.splice(i, 1); i--; break; diff --git a/src/constantCmds.ts b/src/constantCmds.ts index 1574fd9..71c8e72 100644 --- a/src/constantCmds.ts +++ b/src/constantCmds.ts @@ -274,6 +274,10 @@ export const constantCmds = { name: "`-nd`", value: "No Details - Suppresses all details of the requested roll", inline: true + }, { + name: "`-snd`", + value: "Super No Details - Suppresses all details of the requested roll and hides no details message", + inline: true }, { name: "`-s`", value: "Spoiler - Spoilers all details of the requested roll", diff --git a/src/mod.d.ts b/src/mod.d.ts index 5962a2a..6f5d556 100644 --- a/src/mod.d.ts +++ b/src/mod.d.ts @@ -11,6 +11,7 @@ export type EmojiConf = { export type RollModifiers = { noDetails: boolean, + superNoDetails: boolean, spoiler: string, maxRoll: boolean, nominalRoll: boolean,