Add super no details decorator

This commit is contained in:
Ean Milligan (Bastion) 2022-05-06 00:10:21 -04:00
parent 06df068ac2
commit 15e8f847c5
5 changed files with 19 additions and 4 deletions

View File

@ -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

View File

@ -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}`;
}
}
}

View File

@ -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;

View File

@ -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",

1
src/mod.d.ts vendored
View File

@ -11,6 +11,7 @@ export type EmojiConf = {
export type RollModifiers = {
noDetails: boolean,
superNoDetails: boolean,
spoiler: string,
maxRoll: boolean,
nominalRoll: boolean,