Added embed generator for Counts, fixed projectKey for sonar

This commit is contained in:
Ean Milligan (Bastion) 2022-05-20 00:27:27 -04:00
parent 8454d3e189
commit bf382d01ad
4 changed files with 47 additions and 2 deletions

View File

@ -56,7 +56,7 @@ jobs:
args: args:
# Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu)
# mandatory # mandatory
-Dsonar.projectKey=The Artificer '-Dsonar.projectKey=The Artificer'
-Dsonar.organization=milligan.dev -Dsonar.organization=milligan.dev
# Comma-separated paths to directories containing main source files. # Comma-separated paths to directories containing main source files.
#-Dsonar.sources= # optional, default is project base directory #-Dsonar.sources= # optional, default is project base directory

View File

@ -1,4 +1,5 @@
import config from "../config.ts"; import config from "../config.ts";
import { CountDetails } from "./solver/solver.d.ts";
const failColor = 0xe71212; const failColor = 0xe71212;
const warnColor = 0xe38f28; const warnColor = 0xe38f28;
@ -555,3 +556,37 @@ export const generateRollError = (errorType: string, errorMsg: string) => ({
}] }]
}] }]
}); });
export const generateCountDetails = (counts: CountDetails) => ({
embeds: [{
color: infoColor1,
title: "Roll Count Details:",
fields: [
{
name: "Total Rolls:",
details: `${counts.total}`,
inline: true
}, {
name: "Successful Rolls:",
details: `${counts.successful}`,
inline: true
}, {
name: "Failed Rolls:",
details: `${counts.failed}`,
inline: true
}, {
name: "Rerolled Dice:",
details: `${counts.rerolled}`,
inline: true
}, {
name: "Dropped Dice:",
details: `${counts.dropped}`,
inline: true
}, {
name: "Exploded Dice:",
details: `${counts.exploded}`,
inline: true
}
]
}]
});

2
src/mod.d.ts vendored
View File

@ -21,4 +21,4 @@ export type RollModifiers = {
order: string, order: string,
valid: boolean, valid: boolean,
count: boolean count: boolean
} };

View File

@ -38,3 +38,13 @@ export type SolvedRoll = {
line2: string, line2: string,
line3: string line3: string
}; };
// CountDetails is the object holding the count data for creating the Count Embed
export type CountDetails = {
total: number,
successful: number,
failed: number,
rerolled: number,
dropped: number,
exploded: number
};