add hideRaw flag
This commit is contained in:
parent
3bda7a1187
commit
2fe2c5f296
|
@ -5,7 +5,7 @@ meta {
|
|||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8166/api/roll?user=[discord-user-id]&channel=[discord-channel-id]&rollstr=[artificer-roll-cmd]&documentation=All items below are optional. Flags do not need values.&nd=[no-details-flag]&snd=[super-no-details-flag]&s=[spoiler-results-flag]&m-or-max=[max-roll-flag, cannot be used with n flag]&min=[[min-roll-flag, cannot be used with n or max]&n=[nominal-roll-flag, cannot be used with max or min flag]&gms=[csv-of-discord-user-ids-to-be-dmed-results]&o=[order-rolls, must be a or d]&c=[count-flag]
|
||||
url: http://localhost:8166/api/roll?user=[discord-user-id]&channel=[discord-channel-id]&rollstr=[artificer-roll-cmd]&documentation=All items below are optional. Flags do not need values.&nd=[no-details-flag]&snd=[super-no-details-flag]&hr=[hide-raw-roll-details-flag]&s=[spoiler-results-flag]&m-or-max=[max-roll-flag, cannot be used with n flag]&min=[[min-roll-flag, cannot be used with n or max]&n=[nominal-roll-flag, cannot be used with max or min flag]&gms=[csv-of-discord-user-ids-to-be-dmed-results]&o=[order-rolls, must be a or d]&c=[count-flag]
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ params:query {
|
|||
documentation: All items below are optional. Flags do not need values.
|
||||
nd: [no-details-flag]
|
||||
snd: [super-no-details-flag]
|
||||
hr: [hide-raw-roll-details-flag]
|
||||
s: [spoiler-results-flag]
|
||||
m-or-max: [max-roll-flag, cannot be used with n flag]
|
||||
min: [[min-roll-flag, cannot be used with n or max]
|
||||
|
|
|
@ -35,6 +35,7 @@ export interface RollFormat {
|
|||
export interface RollModifiers {
|
||||
noDetails: boolean;
|
||||
superNoDetails: boolean;
|
||||
hideRaw: boolean;
|
||||
spoiler: string;
|
||||
maxRoll: boolean;
|
||||
minRoll: boolean;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) => {
|
||||
|
|
Loading…
Reference in New Issue