Explorar o código

CommandHelp: don't print cmdprefix in management room

In the management room the user don't need to prefix the commands with the
command-prefix. Hence, don't show the prefix in the command list.
Jörg Sommer %!s(int64=6) %!d(string=hai) anos
pai
achega
ae2ccb0d38
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      commands.go

+ 5 - 1
commands.go

@@ -121,7 +121,11 @@ const cmdHelpHelp = `help - Prints this help`
 
 // CommandHelp handles help command
 func (handler *CommandHandler) CommandHelp(ce *CommandEvent) {
-	cmdPrefix := handler.bridge.Config.Bridge.CommandPrefix + " "
+	cmdPrefix := ""
+	if ce.User.ManagementRoom != ce.RoomID {
+		cmdPrefix = handler.bridge.Config.Bridge.CommandPrefix + " "
+	}
+
 	ce.Reply(strings.Join([]string{
 		cmdPrefix + cmdHelpHelp,
 		cmdPrefix + cmdLoginHelp,