From f2b22bc349154fe5c97285b09404b95943503bc2 Mon Sep 17 00:00:00 2001
From: byron <47872200+byeoon@users.noreply.github.com>
Date: Wed, 13 Mar 2024 12:15:39 -0400
Subject: [PATCH] Removed notes, fully moved logging to Logger, fixed
everything back to const (thank you)
---
src/plugins/WebhookManager/README.MD | 1 -
src/plugins/WebhookManager/index.tsx | 14 +++++++-------
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/plugins/WebhookManager/README.MD b/src/plugins/WebhookManager/README.MD
index 8089eabfc..5963c1893 100644
--- a/src/plugins/WebhookManager/README.MD
+++ b/src/plugins/WebhookManager/README.MD
@@ -21,5 +21,4 @@
- Webhook Type
- Creator UserID
- Creator Username
- - Creator Profile
\ No newline at end of file
diff --git a/src/plugins/WebhookManager/index.tsx b/src/plugins/WebhookManager/index.tsx
index 4ff94af2d..58790c21f 100644
--- a/src/plugins/WebhookManager/index.tsx
+++ b/src/plugins/WebhookManager/index.tsx
@@ -68,10 +68,10 @@ export default definePlugin({
}
],
execute: async (option, ctx) => {
- let webhookUrl = findOption(option, "url");
+ const webhookUrl = findOption(option, "url");
await fetch("" + webhookUrl).then(response => response.json())
.then(response => {
- console.log(JSON.stringify(response));
+ WMLogger.info(JSON.stringify(response));
sendBotMessage(ctx.channel.id, {
content: "# Webhook Information: \n" +
"Webhook Username: " + response.name + "\n " +
@@ -122,19 +122,19 @@ export default definePlugin({
],
execute: async (option, ctx) => {
- let webhookUrl = findOption(option, "url");
- let webhookMessage = findOption(option, "message");
- let webhookUsername = findOption(option, "username");
+ const webhookUrl = findOption(option, "url");
+ const webhookMessage = findOption(option, "message");
+ const webhookUsername = findOption(option, "username");
if (findOption(option, "rawjson")) {
Native.executeWebhook("" + webhookUrl, {
- webhookMessage // doubt it will work but it might, might clash with other options such as the username, but once i'm home i'll continue testing.
+ webhookMessage
});
}
else {
Native.executeWebhook("" + webhookUrl, {
content: webhookMessage,
- username: webhookUsername ?? fetch("" + webhookUrl).then(response => response.json()), // still may have issues, supposed to go to webhook name if a custom name is not set, ?? should be the right operator
+ username: webhookUsername ?? fetch("" + webhookUrl).then(response => response.json()),
avatar_url: ""
});
}