1
1
mirror of https://github.com/Burn-E99/TheArtificer.git synced 2026-06-04 00:53:50 -04:00

add hideRaw flag

This commit is contained in:
Ean Milligan
2025-05-05 16:08:18 -04:00
parent 3bda7a1187
commit 2fe2c5f296
5 changed files with 13 additions and 4 deletions

View File

@@ -35,6 +35,7 @@ export interface RollFormat {
export interface RollModifiers {
noDetails: boolean;
superNoDetails: boolean;
hideRaw: boolean;
spoiler: string;
maxRoll: boolean;
minRoll: boolean;

View File

@@ -6,6 +6,7 @@ export const getModifiers = (args: string[]): RollModifiers => {
const modifiers: RollModifiers = {
noDetails: false,
superNoDetails: false,
hideRaw: false,
spoiler: '',
maxRoll: false,
minRoll: false,
@@ -34,6 +35,9 @@ export const getModifiers = (args: string[]): RollModifiers => {
case '-snd':
modifiers.superNoDetails = true;
break;
case '-hr':
modifiers.hideRaw = true;
break;
case '-s':
modifiers.spoiler = '||';
break;

View File

@@ -102,12 +102,13 @@ export const generateRollEmbed = async (authorId: bigint, returnDetails: SolvedR
},
};
} else {
const line1Details = modifiers.hideRaw ? '' : `<@${authorId}>${returnDetails.line1}\n`;
if (modifiers.gmRoll) {
// Roll is a GM Roll, send this in the pub channel (this funciton will be ran again to get details for the GMs)
return {
embed: {
color: infoColor2,
description: `<@${authorId}>${returnDetails.line1}\n\nResults have been messaged to the following GMs: ${
description: `${line1Details}${line1Details ? '\n' : ''}Results have been messaged to the following GMs: ${
modifiers.gms
.map((gm) => (gm.startsWith('<') ? gm : `<@${gm}>`))
.join(' ')
@@ -129,7 +130,7 @@ export const generateRollEmbed = async (authorId: bigint, returnDetails: SolvedR
loggingEnabled && log(LT.LOG, `${returnDetails.line3} |&| ${details}`);
}
const baseDesc = `<@${authorId}>${returnDetails.line1}\n**${line2Details.shift()}:**\n${line2Details.join(': ')}`;
const baseDesc = `${line1Details}**${line2Details.shift()}:**\n${line2Details.join(': ')}`;
// Embed desc limit is 4096
if (baseDesc.length + details.length < 4090) {

View File

@@ -84,6 +84,7 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
const modifiers: RollModifiers = {
noDetails: query.has('nd'),
superNoDetails: query.has('snd'),
hideRaw: query.has('hr'),
spoiler: query.has('s') ? '||' : '',
maxRoll: query.has('m') || query.has('max'),
minRoll: query.has('min'),
@@ -93,8 +94,9 @@ export const apiRoll = async (query: Map<string, string>, apiUserid: bigint): Pr
order: query.has('o') ? query.get('o')?.toLowerCase() || '' : '',
count: query.has('c'),
commaTotals: query.has('ct'),
valid: true,
apiWarn: hideWarn ? '' : apiWarning,
valid: true,
error: new Error(),
};
return new Promise<Response>((resolve) => {