//native
type DiscordWebhook = {
webhook_url: string;
};
export async function main(
discord_webhook: DiscordWebhook,
messageId: string,
newMessageContent: string,
) {
const response = await fetch(
`${discord_webhook.webhook_url}/messages/${messageId}`,
{
method: "PATCH",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({ content: newMessageContent }),
},
);
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`);
}
return await response.json();
}
Submitted by hugo989 17 days ago