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