starboard: Don't star every message and fix embed

master
Luther Wen Xu 2019-11-20 16:24:14 +07:00
parent 46cee1af47
commit 538583c6db
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
2 changed files with 5 additions and 12 deletions

@ -21,7 +21,6 @@ func main() {
} }
dg.AddHandler(messageCreate) dg.AddHandler(messageCreate)
dg.AddHandler(checkPrestigeReact) dg.AddHandler(checkPrestigeReact)
dg.AddHandler(starboardAutoReact)
dg.AddHandler(listenToStarboardReact) dg.AddHandler(listenToStarboardReact)
err = dg.Open() err = dg.Open()
if err != nil { if err != nil {

@ -8,13 +8,6 @@ import (
const starEmoji = "⭐" const starEmoji = "⭐"
func starboardAutoReact(s *discordgo.Session, m *discordgo.MessageCreate) {
err := s.MessageReactionAdd(m.ChannelID, m.ID, starEmoji)
if err != nil {
logError(s, "starboardAutoReact", m.ChannelID, m.ID, err)
}
}
func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAdd) { func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
if m.Emoji.Name != starEmoji { if m.Emoji.Name != starEmoji {
return return
@ -51,10 +44,11 @@ func listenToStarboardReact(s *discordgo.Session, m *discordgo.MessageReactionAd
_, err = s.ChannelMessageSendEmbed( _, err = s.ChannelMessageSendEmbed(
"645551408283648000", "645551408283648000",
&discordgo.MessageEmbed{ &discordgo.MessageEmbed{
Title: "Starred Message", Title: "Starred Message",
URL: "https://discordapp.com/channels/" + m.GuildID + "/" + m.ChannelID + "/" + m.MessageID, Description: msg.Content,
Color: color, URL: "https://discordapp.com/channels/" + m.GuildID + "/" + m.ChannelID + "/" + m.MessageID,
Timestamp: messageTimestamp.Format(time.RFC3339), Color: color,
Timestamp: messageTimestamp.Format(time.RFC3339),
Author: &discordgo.MessageEmbedAuthor{ Author: &discordgo.MessageEmbedAuthor{
Name: msg.Author.Username + "#" + msg.Author.Discriminator, Name: msg.Author.Username + "#" + msg.Author.Discriminator,
IconURL: "https://cdn.discordapp.com/avatars/" + msg.Author.ID + "/" + msg.Author.Avatar + ".png", IconURL: "https://cdn.discordapp.com/avatars/" + msg.Author.ID + "/" + msg.Author.Avatar + ".png",