mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-20 06:30:35 +00:00
me when im at school and bored and decide to keep on making improvements :trolley:
This commit is contained in:
parent
1c3e33dbbd
commit
2f1c10de3e
2 changed files with 26 additions and 14 deletions
|
@ -68,7 +68,7 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
execute: async (option, ctx) => {
|
execute: async (option, ctx) => {
|
||||||
var webhookUrl = findOption(option, "url");
|
let webhookUrl = findOption(option, "url");
|
||||||
await fetch("" + webhookUrl).then(response => response.json())
|
await fetch("" + webhookUrl).then(response => response.json())
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log(JSON.stringify(response));
|
console.log(JSON.stringify(response));
|
||||||
|
@ -105,28 +105,40 @@ export default definePlugin({
|
||||||
description: "The message you want to send.",
|
description: "The message you want to send.",
|
||||||
type: ApplicationCommandOptionType.STRING,
|
type: ApplicationCommandOptionType.STRING,
|
||||||
required: true
|
required: true
|
||||||
}
|
},
|
||||||
/*
|
|
||||||
{
|
{
|
||||||
name: "username",
|
name: "username",
|
||||||
description: "Give the webhook a custom name (Leave blank for default).",
|
description: "Give the webhook a custom name (Leave blank for default).",
|
||||||
type: ApplicationCommandOptionType.STRING,
|
type: ApplicationCommandOptionType.STRING,
|
||||||
required: true
|
required: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "rawjson",
|
||||||
|
description: "Send as a raw JSON",
|
||||||
|
type: ApplicationCommandOptionType.BOOLEAN,
|
||||||
|
required: false
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
],
|
],
|
||||||
execute: async (option, ctx) => {
|
execute: async (option, ctx) => {
|
||||||
|
|
||||||
var webhookUrl = findOption(option, "url");
|
let webhookUrl = findOption(option, "url");
|
||||||
var webhookMessage = findOption(option, "message");
|
let webhookMessage = findOption(option, "message");
|
||||||
// var webhookUsername = findOption(option, "username");
|
let 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.
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
Native.executeWebhook("" + webhookUrl, {
|
Native.executeWebhook("" + webhookUrl, {
|
||||||
content: webhookMessage,
|
content: webhookMessage,
|
||||||
username: fetch("" + webhookUrl).then(response => response.json()), // yea might have issues, sleepy brain as well, will fix tmr
|
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
|
||||||
avatar_url: ""
|
avatar_url: ""
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sendBotMessage(ctx.channel.id, {
|
sendBotMessage(ctx.channel.id, {
|
||||||
content: "Message sent successfully."
|
content: "Message sent successfully."
|
||||||
|
|
Loading…
Reference in a new issue