Make /pin a user level command

The /pin command is now accessable by non-modded users.
This commit is contained in:
Zorchenhimer 2019-09-22 17:02:09 -04:00
parent 54377c65fb
commit 32d58f6f3f
1 changed files with 14 additions and 14 deletions

View File

@ -266,6 +266,19 @@ var commands = &CommandControl{
), nil
},
},
common.CNPin.String(): Command{
HelpText: "Display the current room access type and pin/password (if applicable).",
Function: func(cl *Client, args []string) (string, error) {
switch settings.RoomAccess {
case AccessPin:
return "Room is secured via PIN. Current PIN: " + settings.RoomAccessPin, nil
case AccessRequest:
return "Room is secured via access requests. Users must request to be granted access.", nil
}
return "Room is open access. Anybody can join.", nil
},
},
},
mod: map[string]Command{
@ -394,19 +407,6 @@ var commands = &CommandControl{
return "", nil
},
},
common.CNPin.String(): Command{
HelpText: "Display the current room access type and pin/password (if applicable).",
Function: func(cl *Client, args []string) (string, error) {
switch settings.RoomAccess {
case AccessPin:
return "Room is secured via PIN. Current PIN: " + settings.RoomAccessPin, nil
case AccessRequest:
return "Room is secured via access requests. Users must request to be granted access.", nil
}
return "Room is open access. Anybody can join.", nil
},
},
},
admin: map[string]Command{
@ -580,7 +580,7 @@ func (cc *CommandControl) RunCommand(command string, args []string, sender *Clie
}
// Command not found
common.LogInfof("[cmd] %s /%s %s\n", sender.name, command, strings.Join(args, " "))
common.LogInfof("[cmd|error] %s /%s %s\n", sender.name, command, strings.Join(args, " "))
return "", fmt.Errorf("Invalid command.")
}