fixed that god-awful annoying bug where you couldnt use the default webhook name

This commit is contained in:
byron 2024-03-15 18:44:30 -04:00
parent f43f404123
commit 9c7c3d0c5d

View file

@ -139,7 +139,7 @@ export default definePlugin({
name: "username", name: "username",
description: "Send with a custom webhook username", description: "Send with a custom webhook username",
type: ApplicationCommandOptionType.STRING, type: ApplicationCommandOptionType.STRING,
required: true required: false
}, },
{ {
name: "tts", name: "tts",
@ -165,9 +165,11 @@ export default definePlugin({
}); });
} }
else { else {
fetch("" + webhookUrl).then(response => response.json().then(response => { if (webhookUsername === "") { webhookUsername = response.name; } }));
Native.executeWebhook("" + webhookUrl, { Native.executeWebhook("" + webhookUrl, {
content: webhookMessage, content: webhookMessage,
username: webhookUsername ?? fetch("" + webhookUrl).then(response => response.json().then(response => { webhookUsername = response.name; })), username: webhookUsername,
avatar_url: "", avatar_url: "",
tts: findOption(option, "tts") tts: findOption(option, "tts")
}); });