starboard: Allow starring of starred messages and prevent starred messages from getting reposted

master
Luther Wen Xu 2019-11-20 16:57:23 +07:00
parent 11505f0e1a
commit a68dc0e9bf
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
1 changed files with 11 additions and 2 deletions

@ -7,8 +7,12 @@ import (
)
const starEmoji = "⭐"
const starChannel = "645551408283648000"
func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
if m.ChannelID == starChannel {
return
}
if m.Emoji.Name != starEmoji {
return
}
@ -41,8 +45,8 @@ func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAd
//White as fallback
color = 0xFFFFFF
}
_, err = s.ChannelMessageSendEmbed(
"645551408283648000",
msg, err = s.ChannelMessageSendEmbed(
starChannel,
&discordgo.MessageEmbed{
Title: "Starred Message",
Description: msg.Content,
@ -57,5 +61,10 @@ func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAd
)
if err != nil {
logError(s, "listenToStarboardReact", "channelMessageSendEmbed", err)
return
}
err = s.MessageReactionAdd(msg.ChannelID, msg.ID, starEmoji)
if err != nil {
logError(s, "listenToStarboardReact", "messageReactionAdd", err)
}
}