let's not repin if the message is already pinned
This commit is contained in:
parent
19541281f2
commit
1ace993319
2
main.go
2
main.go
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue