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