Fix: Do not try to compare non existing embed

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-12-06 13:48:38 +01:00
parent 3f2c4703ef
commit 5f004fdab0
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -111,7 +111,7 @@ func (m modReactionRole) Setup() error {
Content: contentString,
Embed: msgEmbed,
})
} else if !isDiscordMessageEmbedEqual(managedMsg.Embeds[0], msgEmbed) || managedMsg.Content != contentString {
} else if (len(managedMsg.Embeds) > 0 && !isDiscordMessageEmbedEqual(managedMsg.Embeds[0], msgEmbed)) || managedMsg.Content != contentString {
_, err = m.discord.ChannelMessageEditComplex(&discordgo.MessageEdit{
Content: &contentString,
Embed: msgEmbed,