From 2da6a647488b3602fd57bea641e79a0000b54b9c Mon Sep 17 00:00:00 2001 From: byron <47872200+byeoon@users.noreply.github.com> Date: Wed, 13 Mar 2024 18:02:42 -0400 Subject: [PATCH] Ready for reviews / feedback --- src/plugins/WebhookManager/index.tsx | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/plugins/WebhookManager/index.tsx b/src/plugins/WebhookManager/index.tsx index 178a6c049..bf6860f0f 100644 --- a/src/plugins/WebhookManager/index.tsx +++ b/src/plugins/WebhookManager/index.tsx @@ -90,7 +90,6 @@ export default definePlugin({ sourceChannelGet = ""; } sendBotMessage(ctx.channel.id, { - embeds: [ { // @ts-ignore @@ -141,25 +140,24 @@ export default definePlugin({ type: ApplicationCommandOptionType.STRING, required: true }, - { - name: "rawjson", - description: "Send message as raw JSON", - type: ApplicationCommandOptionType.BOOLEAN, - required: false - }, { name: "tts", description: "Send with TTS", type: ApplicationCommandOptionType.BOOLEAN, required: false + }, + { + name: "rawjson", + description: "Send message as raw JSON", + type: ApplicationCommandOptionType.BOOLEAN, + required: false } - ], execute: async (option, ctx) => { const webhookUrl = findOption(option, "url"); const webhookMessage = findOption(option, "message"); - const webhookUsername = findOption(option, "username"); + let webhookUsername = findOption(option, "username"); if (findOption(option, "rawjson")) { Native.executeWebhook("" + webhookUrl, { webhookMessage @@ -168,12 +166,11 @@ export default definePlugin({ else { Native.executeWebhook("" + webhookUrl, { content: webhookMessage, - username: webhookUsername ?? fetch("" + webhookUrl).then(response => response.json()), + username: webhookUsername ?? fetch("" + webhookUrl).then(response => response.json().then(response => { response.name; })), avatar_url: "", tts: findOption(option, "tts") }); } - sendBotMessage(ctx.channel.id, { content: "Message sent successfully." });