forked from Galactic/galactic-bot
bugfix to string formatting
This commit is contained in:
parent
b36ec44bb2
commit
2fad9cc2d2
@ -42,7 +42,7 @@ export type DiscordStruct = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export type FormatParams = {
|
export type FormatParams = {
|
||||||
[key: string]: string | number | boolean | undefined
|
[key: string]: string | number | boolean | undefined | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FormatOpts = {
|
export type FormatOpts = {
|
||||||
|
@ -59,7 +59,7 @@ class LocaleLoader
|
|||||||
|
|
||||||
for (const [ parameter, value ] of Object.entries(parameters))
|
for (const [ parameter, value ] of Object.entries(parameters))
|
||||||
{
|
{
|
||||||
if (!value)
|
if (typeof value === 'undefined' || value === null)
|
||||||
continue;
|
continue;
|
||||||
string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value.toString());
|
string = string.replace(new RegExp(Util.escapeRegex(`{${parameter.toLowerCase()}}`), 'giu'), value.toString());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user