Removed notes, fully moved logging to Logger, fixed everything back to const (thank you)

This commit is contained in:
byron 2024-03-13 12:15:39 -04:00 committed by GitHub
parent 2f1c10de3e
commit f2b22bc349
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 8 deletions

View file

@ -21,5 +21,4 @@
- Webhook Type<br>
- Creator UserID<br>
- Creator Username<br>
- Creator Profile<br>
</details>

View file

@ -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: ""
});
}