|
|
|
@ -4,7 +4,9 @@ import (
|
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
|
|
|
|
|
|
|
|
"TerraOceanBot/db"
|
|
|
|
|
"TerraOceanBot/discord/backend"
|
|
|
|
|
"TerraOceanBot/discord/config"
|
|
|
|
|
"TerraOceanBot/server"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var minecraftConfirmReact = make(map[string]string)
|
|
|
|
@ -66,6 +68,7 @@ func ConfirmMinecraftUsername(s *discordgo.Session, r *discordgo.MessageReaction
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func processUsernameUpdate(s *discordgo.Session, discordID, channelID, newUsername string) {
|
|
|
|
|
oldUsername, oldErr := db.GetMinecraftUsername(discordID)
|
|
|
|
|
err := db.SetMinecraftUsername(discordID, newUsername)
|
|
|
|
|
if err == db.ErrAlreadyExists {
|
|
|
|
|
initNewEmbed(
|
|
|
|
@ -75,6 +78,12 @@ func processUsernameUpdate(s *discordgo.Session, discordID, channelID, newUserna
|
|
|
|
|
).Send(s, channelID)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
backend.UpdateVoiceChannelState(s)
|
|
|
|
|
if oldErr == nil {
|
|
|
|
|
server.WhitelistRemove(oldUsername)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
initNewEmbed(
|
|
|
|
|
config.SetMCUsernameSuccessTitle,
|
|
|
|
|
config.SetMCUsernameSuccessDescription,
|
|
|
|
|