fix: uws warning when async task

This commit is contained in:
MARCROCK22 2024-03-31 15:10:50 -04:00
parent da7a2ae946
commit 492d373d83

View File

@ -1,4 +1,9 @@
import { type APIInteraction, InteractionResponseType, InteractionType } from 'discord-api-types/v10'; import {
type APIInteractionResponse,
InteractionResponseType,
InteractionType,
type APIInteraction,
} from 'discord-api-types/v10';
import { filetypeinfo } from 'magic-bytes.js'; import { filetypeinfo } from 'magic-bytes.js';
import type { HttpRequest, HttpResponse } from 'uWebSockets.js'; import type { HttpRequest, HttpResponse } from 'uWebSockets.js';
import { OverwrittenMimeTypes } from '../api'; import { OverwrittenMimeTypes } from '../api';
@ -131,7 +136,8 @@ export class HttpClient extends BaseClient {
break; break;
default: default:
await onInteractionCreate(this, rawBody, -1, async ({ body, files }) => { await onInteractionCreate(this, rawBody, -1, async ({ body, files }) => {
let response; res.cork(() => {
let response: FormData | APIInteractionResponse;
const headers: { 'Content-Type'?: string } = {}; const headers: { 'Content-Type'?: string } = {};
if (files) { if (files) {
@ -170,6 +176,7 @@ export class HttpClient extends BaseClient {
return res.end(JSON.stringify(response)); return res.end(JSON.stringify(response));
}); });
});
break; break;
} }
} }