prestige: Listen to event

master
Luther Wen Xu 2019-11-19 16:12:16 +07:00
parent 7600a9e5a6
commit 7739c8272c
Signed by: chanbakjsd
GPG Key ID: B7D77E3E9D102B70
2 changed files with 4 additions and 0 deletions

@ -20,6 +20,7 @@ func main() {
return return
} }
dg.AddHandler(messageCreate) dg.AddHandler(messageCreate)
dg.AddHandler(checkPrestigeReact)
err = dg.Open() err = dg.Open()
if err != nil { if err != nil {
fmt.Println("Error opening Discord session:", err) fmt.Println("Error opening Discord session:", err)

@ -109,6 +109,9 @@ func checkPrestigeReact(s *discordgo.Session, m *discordgo.MessageReactionAdd) {
if prestigeList[m.MessageID] != m.UserID { if prestigeList[m.MessageID] != m.UserID {
return return
} }
if m.Emoji.Name != emojiCheck {
return
}
xp := getXP(s, m.UserID) xp := getXP(s, m.UserID)
newPrestigeLevel := xp/prestigeRequirement + 1 newPrestigeLevel := xp/prestigeRequirement + 1
go cleanUpRole(s, m.UserID) go cleanUpRole(s, m.UserID)