handle if there is no profile pic option, also making it string only because compatibility issues

This commit is contained in:
byron 2024-03-18 11:28:08 -04:00 committed by GitHub
parent 1947cedd55
commit 2ac335c3f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -126,8 +126,8 @@ export default definePlugin({
},
{
name: "pfp",
description: "Send with a custom profile picture.",
type: ApplicationCommandOptionType.ATTACHMENT,
description: "Send with a custom profile picture. You must input a valid image URL.",
type: ApplicationCommandOptionType.STRING,
required: false
},
{
@ -141,7 +141,7 @@ export default definePlugin({
const webhookUrl = findOption(option, "url");
const webhookMessage = findOption(option, "message");
const webhookProfilePic = findOption(option, "pfp");
let webhookProfilePic = findOption(option, "pfp");
let webhookUsername = findOption(option, "username");
if (findOption(option, "raw")) {
Native.executeWebhook("" + webhookUrl, {
@ -153,6 +153,10 @@ export default definePlugin({
webhookUsername = undefined;
}
if (webhookProfilePic === "") {
webhookProfilePic = undefined;
}
Native.executeWebhook("" + webhookUrl, {
content: webhookMessage,
username: webhookUsername,