Updated verification

This commit is contained in:
Eduard Urbach 2018-11-14 18:39:56 +09:00
parent fa88211b6b
commit f2f4d06d09

View File

@ -96,16 +96,27 @@ func Verify(s *discordgo.Session, msg *discordgo.MessageCreate) bool {
}
}
// Give supporter role
// Give or remove supporter role
if user.IsPro() {
s.GuildMemberRoleAdd(guildID, msg.Author.ID, supporterRole)
} else {
s.GuildMemberRoleRemove(guildID, msg.Author.ID, supporterRole)
}
// Update nickname to notify.moe nick
err = s.GuildMemberNickname(guildID, msg.Author.ID, user.Nick)
if err != nil {
color.Red("Error updating nickname: %s", err.Error())
}
// Update notify.moe user account
user.Accounts.Discord.Verified = true
user.Save()
if !user.Accounts.Discord.Verified {
user.Accounts.Discord.Verified = true
user.Save()
}
// Send success message
s.ChannelMessageSend(msg.ChannelID, "Thank you, you are now a verified member of the notify.moe community!")
s.ChannelMessageSend(msg.ChannelID, fmt.Sprintf("%s Thank you, you are now a verified member of the notify.moe community!", msg.Author.Mention()))
return true
}