mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-13 07:25:03 +01:00
rename psn command
This commit is contained in:
@@ -82,16 +82,16 @@ func sendServerChatMessage(s *Session, message string) {
|
||||
}
|
||||
|
||||
func parseChatCommand(s *Session, command string) {
|
||||
if strings.HasPrefix(command, commands["LinkPSN"].Prefix) {
|
||||
if commands["LinkPSN"].Enabled {
|
||||
if strings.HasPrefix(command, commands["PSN"].Prefix) {
|
||||
if commands["PSN"].Enabled {
|
||||
var id string
|
||||
n, err := fmt.Sscanf(command, fmt.Sprintf("%s %%s", commands["LinkPSN"].Prefix), &id)
|
||||
n, err := fmt.Sscanf(command, fmt.Sprintf("%s %%s", commands["PSN"].Prefix), &id)
|
||||
if err != nil || n != 1 {
|
||||
sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandLinkPSNError"], commands["LinkPSN"].Prefix))
|
||||
sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandPSNError"], commands["PSN"].Prefix))
|
||||
} else {
|
||||
_, err = s.server.db.Exec(`UPDATE users u SET psn_id=$1 WHERE u.id=(SELECT c.user_id FROM characters c WHERE c.id=$2)`, id, s.charID)
|
||||
if err == nil {
|
||||
sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandLinkPSNSuccess"], id))
|
||||
sendServerChatMessage(s, fmt.Sprintf(s.server.dict["commandPSNSuccess"], id))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user