let's not repin if the message is already pinned

This commit is contained in:
Julius 2020-09-07 20:49:42 +02:00
parent 19541281f2
commit 1ace993319

View file

@ -64,7 +64,7 @@ func messageReac(s *discordgo.Session, event *discordgo.MessageReaction) {
for _, reaction := range msg.Reactions { for _, reaction := range msg.Reactions {
if reaction.Emoji.Name == "📌" { if reaction.Emoji.Name == "📌" {
var msgErr error var msgErr error
if reaction.Count >= 5 { if reaction.Count >= 5 && !msg.Pinned {
msgErr = s.ChannelMessagePin(event.ChannelID, event.MessageID) msgErr = s.ChannelMessagePin(event.ChannelID, event.MessageID)
} else if reaction.Count <= 3 { } else if reaction.Count <= 3 {
msgErr = s.ChannelMessageUnpin(event.ChannelID, event.MessageID) msgErr = s.ChannelMessageUnpin(event.ChannelID, event.MessageID)