forked from Supositware/Haha-Yes
Don't make embed undefined on edit if it doesn't have a description
This commit is contained in:
parent
8f4b21f904
commit
6fa84b1e4a
2 changed files with 10 additions and 2 deletions
|
@ -79,13 +79,17 @@ class MessageReactionAddListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
let message = await channel.messages.get(boardID);
|
let message = await channel.messages.get(boardID);
|
||||||
|
// If the original embed description is empty make this embed empty ( and not undefined )
|
||||||
|
let description;
|
||||||
|
if (message.embeds[0].description == undefined)
|
||||||
|
description = '';
|
||||||
|
|
||||||
let Embed = client.util.embed()
|
let Embed = client.util.embed()
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
.setColor(reaction.message.member.displayHexColor)
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
||||||
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
|
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
|
||||||
.addField('Channel', reaction.message.channel, true)
|
.addField('Channel', reaction.message.channel, true)
|
||||||
.setDescription(message.embeds[0].description)
|
.setDescription(description)
|
||||||
.setFooter(reactionCount + ' ' + emote)
|
.setFooter(reactionCount + ' ' + emote)
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
|
|
@ -77,13 +77,17 @@ class messageReactionRemoveListener extends Listener {
|
||||||
}
|
}
|
||||||
|
|
||||||
let message = await channel.messages.get(boardID);
|
let message = await channel.messages.get(boardID);
|
||||||
|
// If the original embed description is empty make this embed empty ( and not undefined )
|
||||||
|
let description;
|
||||||
|
if (message.embeds[0].description == undefined)
|
||||||
|
description = '';
|
||||||
|
|
||||||
let Embed = client.util.embed()
|
let Embed = client.util.embed()
|
||||||
.setColor(reaction.message.member.displayHexColor)
|
.setColor(reaction.message.member.displayHexColor)
|
||||||
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
.setAuthor(reaction.message.author.username, reaction.message.author.displayAvatarURL())
|
||||||
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
|
.addField('Jump to', `[message](https://discordapp.com/channels/${reaction.message.guild.id}/${reaction.message.channel.id}/${reaction.message.id})`, true)
|
||||||
.addField('Channel', reaction.message.channel, true)
|
.addField('Channel', reaction.message.channel, true)
|
||||||
.setDescription(message.embeds[0].description)
|
.setDescription(description)
|
||||||
.setFooter(reactionCount + ' ' + emote)
|
.setFooter(reactionCount + ' ' + emote)
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue