Added extra information for 'Type 2' Webhooks (Server Following / Announcements), more small tweaks to the embed

This commit is contained in:
byron 2024-03-13 17:46:28 -04:00
parent 1225861843
commit 9fab41449a

View file

@ -12,7 +12,8 @@ import { RestAPI } from "@webpack/common";
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");
let sourceGuildGet;
let sourceChannelGet;
export default definePlugin({ export default definePlugin({
name: "WebhookManager", name: "WebhookManager",
description: "Manage your webhooks easily; delete, send messages, get detailed info and more.", description: "Manage your webhooks easily; delete, send messages, get detailed info and more.",
@ -73,14 +74,27 @@ export default definePlugin({
.then(response => { .then(response => {
WMLogger.info(JSON.stringify(response)); WMLogger.info(JSON.stringify(response));
if (response.type === 2) { if (response.type === 2) {
const sourceGuild = response.source_guild; const sourceGuild = `
const sourceChannel = response.source_channel; Source Server ID: ${response.source_guild.id}
Source Server Name: ${response.source_guild.name}
`;
sourceGuildGet = sourceGuild;
const sourceChannel = `
Source Channel ID: ${response.source_channel.id}
Source Channel Name: ${response.source_channel.name}
`;
sourceChannelGet = sourceChannel;
}
else {
sourceGuildGet = "";
sourceChannelGet = "";
} }
sendBotMessage(ctx.channel.id, { sendBotMessage(ctx.channel.id, {
embeds: [ embeds: [
{ {
// @ts-ignore // @ts-ignore
title: ` ${response.name}'s Webhook Information`, title: `Webhook Information`,
color: '#00007d', color: '#00007d',
author: { author: {
// @ts-ignore // @ts-ignore
@ -95,6 +109,8 @@ export default definePlugin({
Webhook Type: ${response.type} Webhook Type: ${response.type}
Channel ID: ${response.channel_id} Channel ID: ${response.channel_id}
Server ID: ${response.guild_id} Server ID: ${response.guild_id}
${sourceGuildGet}
${sourceChannelGet}
Creator Profile: <@${response.user.id}>` Creator Profile: <@${response.user.id}>`
}] }]
@ -123,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: false required: true
}, },
{ {
name: "rawjson", name: "rawjson",