mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-19 22:20:34 +00:00
Fixed bug that was caused when doing /webhook info, also updated the embed style and looks better
This commit is contained in:
parent
9b600b9dad
commit
1225861843
2 changed files with 17 additions and 9 deletions
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
import { ApplicationCommandInputType, ApplicationCommandOptionType, findOption, sendBotMessage } from "@api/Commands";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
import { Logger } from "@utils/Logger";
|
||||||
import definePlugin, { PluginNative } from "@utils/types";
|
import definePlugin, { PluginNative } from "@utils/types";
|
||||||
import { RestAPI } from "@webpack/common";
|
import { RestAPI } from "@webpack/common";
|
||||||
import { Logger } from "@utils/Logger";
|
|
||||||
|
|
||||||
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
|
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
|
||||||
const WMLogger = new Logger("WebhookManager");
|
const WMLogger = new Logger("WebhookManager");
|
||||||
|
@ -72,15 +72,24 @@ export default definePlugin({
|
||||||
await fetch("" + webhookUrl).then(response => response.json())
|
await fetch("" + webhookUrl).then(response => response.json())
|
||||||
.then(response => {
|
.then(response => {
|
||||||
WMLogger.info(JSON.stringify(response));
|
WMLogger.info(JSON.stringify(response));
|
||||||
|
if (response.type === 2) {
|
||||||
|
const sourceGuild = response.source_guild;
|
||||||
|
const sourceChannel = response.source_channel;
|
||||||
|
}
|
||||||
sendBotMessage(ctx.channel.id, {
|
sendBotMessage(ctx.channel.id, {
|
||||||
embeds: [
|
embeds: [
|
||||||
{
|
{
|
||||||
title: "Webhook Information",
|
// @ts-ignore
|
||||||
|
title: ` ${response.name}'s Webhook Information`,
|
||||||
|
color: '#00007d',
|
||||||
author: {
|
author: {
|
||||||
icon_url: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`
|
// @ts-ignore
|
||||||
|
icon_url: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`,
|
||||||
|
proxy_icon_url: `https://cdn.discordapp.com/avatars/${response.id}/${response.avatar}.png`,
|
||||||
|
name: response.name,
|
||||||
|
url: ""
|
||||||
},
|
},
|
||||||
content: `
|
description: `
|
||||||
Webhook Username: ${response.name}
|
|
||||||
Webhook ID: ${response.id}
|
Webhook ID: ${response.id}
|
||||||
Webhook Token: ${response.token}
|
Webhook Token: ${response.token}
|
||||||
Webhook Type: ${response.type}
|
Webhook Type: ${response.type}
|
||||||
|
@ -156,4 +165,4 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});;;;;
|
});
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
todo: also add web support (should be as easy as if navigator is on web or smthn like that, might even have a variable for that somewhere)
|
todo: also add web support (should be as easy as if navigator is on web or smthn like that, might even have a variable for that somewhere)
|
||||||
(thank you official vendicated vending machine 2024 real)
|
(thank you official vendicated vending machine 2024 real)
|
||||||
|
@ -22,9 +21,9 @@ export function executeWebhook(_, url: string, body: object) {
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
"Content-Type": "application/json",
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
req.write(JSON.stringify(body));
|
req.write(JSON.stringify(body));
|
||||||
req.end();
|
req.end();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue