Files
NitroSniper/native.ts

37 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

2026-05-01 10:25:52 -04:00
/*
Made with by neoarz
I am not responsible for any damage caused by this plugin; use at your own risk
Vencord does not endorse/support this plugin (Works with Equicord as well)
dm @neoarz if u need help or have any questions
https://github.com/neoarz/NitroSniper
*/
2026-04-22 22:02:36 -04:00
import { IpcMainInvokeEvent } from "electron";
import type { NativeWebhookResponse } from "./types";
export async function sendWebhook(_: IpcMainInvokeEvent, webhookUrl: string, payload: string): Promise<NativeWebhookResponse> {
try {
const url = new URL(webhookUrl);
url.searchParams.set("wait", "true");
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: payload
});
return {
status: response.status,
data: await response.text()
};
} catch (error) {
return {
status: -1,
data: error instanceof Error ? error.message : String(error)
2026-04-22 22:02:36 -04:00
};
}
}