I try to change an already send Embed per command. I got an command that makes an embed and sends it in an user defined Channel (selchannel). But when i try to edit the Embed I get:
DiscordAPIError: Cannot edit a message authored by another user
But the Message was send by the bot so why does it say this?
How i send the original Embed:
// constructing Embed...
let messageEmbed = await client.channels.cache.get(selchannel).send({embed: EmbedMessage})
module.exports = {
messageEmbed,
EmbedMessage
}
How i try to edit it:
module.exports = {
name: 'edit-embed',
description: 'Edits send Embed',
async execute(message, args) {
const Discord = require('discord.js');
const { messageEmbed } = require('./embed');
const { EmbedMessage } = require('./embed');
const { prefix } = require('/home/ubuntu/discord-bot/main.js');
const sender = `${message.author.tag}`;
const InputSlice = message.content.slice(prefix.length).trim().split(' ');
const sEmbed = args.shift().toLowerCase();
const newEmbed = new Discord.MessageEmbed()
.setColor('#8022FF')
.setTitle('.........:')
.addFields(
{name: '\u200B', value: '\u200B'},
{name: '........: ', value: ' ............' },
{name: '\u200B', value: '\u200B'}
)
.setImage('...........')
.setFooter(`............ -(${sender})-`);
message.edit(sEmbed).then(newEmbed);
}
}
What am i doin' wrong?
message.edittries to edit the message with the command and that's coming from a user, not the bot. Shouldn't it bemessageEmbed.edit(newEmbed)? - Zsolt Meszaros