diff options
| author | Fuwn <[email protected]> | 2025-09-09 18:05:15 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2025-09-09 18:05:15 -0700 |
| commit | 9678e4e1e87a5d73c47683fe85848888ca8e857b (patch) | |
| tree | 42235ab613eba920ef46ceaba946f2fdc6362427 /src/discord/responses.ts | |
| parent | fix: Properly handle videos (diff) | |
| download | umabotdiscord-9678e4e1e87a5d73c47683fe85848888ca8e857b.tar.xz umabotdiscord-9678e4e1e87a5d73c47683fe85848888ca8e857b.zip | |
refactor: Move Discord APIs to Discord module
Diffstat (limited to 'src/discord/responses.ts')
| -rw-r--r-- | src/discord/responses.ts | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/discord/responses.ts b/src/discord/responses.ts new file mode 100644 index 0000000..da72967 --- /dev/null +++ b/src/discord/responses.ts @@ -0,0 +1,15 @@ +import type { DiscordResponse } from './interfaces.ts'; + +export class JSONResponse extends Response { + constructor(body: DiscordResponse | { error: string }, init?: ResponseInit) { + const jsonBody = JSON.stringify(body); + + init = init || { + headers: { + 'content-type': 'application/json;charset=UTF-8', + }, + }; + + super(jsonBody, init); + } +} |