I'm new in coding...
So I've been trying to make a webhook embed with raw JSON but the webhook doesn't seem to work.
This is what I used:
run: async (client, message, args) => {
if (!message.member.hasPermission("MANAGE_WEBHOOKS")) {
return message.channel.send(
`You need to have permission to use this command!`
);
}
message.delete();
let user =
message.mentions.members.first() ||
message.guild.members.cache.get(args[0]);
if (!user) return message.channel.send("Please provide a user!");
const webhook = await message.channel.createWebhook(user.displayName, {
avatar: user.user.displayAvatarURL(),
channel: message.channel.id
});
let message2 = args.slice(1).join(" ")
await webhook.send(message2).then(() => {
let embed1 = JSON.parse(message2);
return message.channel.send({embed: embed1});
webhook.delete();
});
}
};
It sends both the JSON and its embed...
I need help