summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-21 11:35:06 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-02-21 11:35:06 +1100
commit5f553cc614096e8c2456be1e47247df9aaa3bd29 (patch)
tree1f588f72f138ca7ff8e1e8f344a89c9abbdfd1f3 /src
parentFix channel mentions #981 (diff)
downloadserver-5f553cc614096e8c2456be1e47247df9aaa3bd29.tar.xz
Close #954
Diffstat (limited to 'src')
-rw-r--r--src/api/Server.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/api/Server.ts b/src/api/Server.ts

index 01c60f23..78870669 100644 --- a/src/api/Server.ts +++ b/src/api/Server.ts
@@ -84,6 +84,25 @@ export class FosscordServer extends Server { ); } + // Discord.com sends ISO strings with +00:00 extension, not Z + // This causes issues with Python bot libs + this.app.set( + "json replacer", + function ( + this: { [key: string]: unknown }, + key: string, + value: unknown, + ) { + if (this[key] instanceof Date) { + return (this[key] as Date) + .toISOString() + .replace("Z", "+00:00"); + } + + return value; + }, + ); + this.app.use(CORS); this.app.use(BodyParser({ inflate: true, limit: "10mb" }));