Fixed a ton of things, thank you suggestions and code reviews

This commit is contained in:
byron 2024-03-12 22:34:10 -04:00 committed by GitHub
parent 284a951353
commit 4ea2d1ca5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 15 deletions

2
.gitignore vendored
View file

@ -18,7 +18,5 @@ lerna-debug.log*
.pnpm-debug.log*
*.tsbuildinfo
src/userplugins
ExtensionCache/
settings/

View file

@ -9,9 +9,6 @@ import { Devs } from "@utils/constants";
import definePlugin, { PluginNative } from "@utils/types";
import { RestAPI } from "@webpack/common";
export let webhookDefaultName;
export let webhookUrlGLOBAL;
export let webhookMessageGLOBAL;
const Native = VencordNative.pluginHelpers.WebhookManager as PluginNative<typeof import("./native")>;
export default definePlugin({
@ -36,7 +33,7 @@ export default definePlugin({
execute: async (option, ctx) => {
const res = await RestAPI.delete({ url: "" + findOption(option, "url") });
try {
if (res.ok === true) {
if (res.ok) {
sendBotMessage(ctx.channel.id, {
content: "Webhook deleted successfully."
});
@ -85,8 +82,7 @@ export default definePlugin({
"# Webhook Creator Information: \n " +
"Creator UserID: " + response.user.id + "\n " +
"Creator Username: " + response.user.username + " | ( <@" + response.user.id + "> )" + "\n " +
"Creator Profile: [Click Me](https://img.discord.dog/" + response.user.id + ") \n"
"Creator Username: " + "<@" + response.user.id + ">" + "\n "
});
});
}
@ -123,16 +119,10 @@ export default definePlugin({
var webhookUrl = findOption(option, "url");
var webhookMessage = findOption(option, "message");
// var webhookUsername = findOption(option, "username");
webhookUrlGLOBAL = webhookUrl;
webhookMessageGLOBAL = webhookMessage;
await fetch("" + webhookUrl).then(response => response.json())
.then(response => {
webhookDefaultName = response.name;
});
Native.executeWebhook("" + webhookUrl, {
content: webhookMessage,
username: webhookDefaultName,
username: fetch("" + webhookUrl).then(response => response.json()), // yea might have issues, sleepy brain as well, will fix tmr
avatar_url: ""
});