Skip to content

Commit

Permalink
refactor(network): use new api url for sending webhook messages
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-737 committed Feb 22, 2024
1 parent af508e7 commit afd9ecd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/scripts/network/sendMessage.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { APIMessage, WebhookMessageCreateOptions } from 'discord.js';

export default async (message: WebhookMessageCreateOptions, webhookUrl: string) => {
const res = await fetch('https://interchat-networkwebhook.vercel.app/api/send', {
method: 'PUT',
const res = await fetch('https://api.interchat.fun/send', {
method: 'POST',
body: JSON.stringify(message),
headers: {
authorization: `${process.env.NETWORK_API_KEY}`,
Expand All @@ -13,5 +13,7 @@ export default async (message: WebhookMessageCreateOptions, webhookUrl: string)

const resBody = await res.json();

return res.status === 200 ? (resBody.result as APIMessage) : String(resBody.error);
return res.status === 200
? (resBody as APIMessage)
: String(resBody.error.message ?? resBody.error);
};

0 comments on commit afd9ecd

Please sign in to comment.