Add a colour override for embed colours
All checks were successful
Test / build (push) Successful in 9s
All checks were successful
Test / build (push) Successful in 9s
- Using a new optional value in the JSON, if set overrides the default one set by the rarity - Added a failsafe if the override colour is invalid to default and log a warning #349
This commit is contained in:
parent
a10eaf7d75
commit
5deb6fcc14
3 changed files with 30 additions and 1 deletions
|
@ -39,4 +39,18 @@ export default class StringTools {
|
|||
public static ReplaceAll(str: string, find: string, replace: string) {
|
||||
return str.replace(new RegExp(find, "g"), replace);
|
||||
}
|
||||
|
||||
public static IsHexCode(str: string): boolean {
|
||||
if (str.length != 6) return false;
|
||||
|
||||
const characters = "0123456789abcdefABCDEF";
|
||||
|
||||
for (let i = 0; i < 6; i++) {
|
||||
const char = str[i];
|
||||
|
||||
if (!characters.includes(char)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue