Could simplify this to one variable instead

This commit is contained in:
byron 2024-03-15 21:00:40 -04:00
parent 9c7c3d0c5d
commit 8a09cb533b

View file

@ -13,7 +13,6 @@ import { RestAPI } from "@webpack/common";
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
const WMLogger = new Logger("WebhookManager");
let sourceGuildGet;
let sourceChannelGet;
export default definePlugin({
name: "WebhookManager",
description: "Manage your webhooks easily; delete, send messages, get detailed info and more.",
@ -74,20 +73,16 @@ export default definePlugin({
.then(response => {
WMLogger.info(JSON.stringify(response));
if (response.type === 2) {
const sourceGuild = `
const sourceWebhook = `
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;
sourceGuildGet = sourceWebhook;
}
else {
sourceGuildGet = "";
sourceChannelGet = "";
}
sendBotMessage(ctx.channel.id, {
content: `This webhook was created by <@${response.user.id}>.`,
@ -110,7 +105,6 @@ export default definePlugin({
Channel ID: ${response.channel_id}
Server ID: ${response.guild_id}
${sourceGuildGet}
${sourceChannelGet}
Creator UserID: ${response.user.id}`
}]
@ -173,6 +167,7 @@ export default definePlugin({
avatar_url: "",
tts: findOption(option, "tts")
});
}
sendBotMessage(ctx.channel.id, {
content: "Message sent successfully."