mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
Hotfix 20
This commit is contained in:
parent
2e49319e9c
commit
5852adadad
1 changed files with 27 additions and 0 deletions
|
@ -430,9 +430,36 @@ export function validateAndParseMessageContent(input: unknown): StrictMessageCon
|
||||||
delete (input as any).embed;
|
delete (input as any).embed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dropNullValuesRecursively(input);
|
||||||
|
|
||||||
return (zStrictMessageContent.parse(input) as unknown) as StrictMessageContent;
|
return (zStrictMessageContent.parse(input) as unknown) as StrictMessageContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dropNullValuesRecursively(obj: any) {
|
||||||
|
if (obj == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Array.isArray(obj)) {
|
||||||
|
for (const item of obj) {
|
||||||
|
dropNullValuesRecursively(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof obj !== "object") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(obj)) {
|
||||||
|
if (value == null) {
|
||||||
|
delete obj[key];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
dropNullValuesRecursively(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mirrors AllowedMentions from Eris
|
* Mirrors AllowedMentions from Eris
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue