mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 18:52:41 +01:00
services: Explicitly show when commands have been disabled in the HELP output
This commit is contained in:
parent
de7b679fc5
commit
f142bf065d
@ -134,18 +134,24 @@ func serviceHelpHandler(service *ircService, server *Server, client *Client, par
|
|||||||
if params == "" {
|
if params == "" {
|
||||||
// show general help
|
// show general help
|
||||||
var shownHelpLines sort.StringSlice
|
var shownHelpLines sort.StringSlice
|
||||||
|
var disabledCommands bool
|
||||||
for _, commandInfo := range service.Commands {
|
for _, commandInfo := range service.Commands {
|
||||||
// skip commands user can't access
|
// skip commands user can't access
|
||||||
if 0 < len(commandInfo.capabs) && !client.HasRoleCapabs(commandInfo.capabs...) {
|
if 0 < len(commandInfo.capabs) && !client.HasRoleCapabs(commandInfo.capabs...) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if commandInfo.enabled != nil && !commandInfo.enabled(server) {
|
if commandInfo.enabled != nil && !commandInfo.enabled(server) {
|
||||||
|
disabledCommands = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
shownHelpLines = append(shownHelpLines, " "+client.t(commandInfo.helpShort))
|
shownHelpLines = append(shownHelpLines, " "+client.t(commandInfo.helpShort))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if disabledCommands {
|
||||||
|
shownHelpLines = append(shownHelpLines, " "+client.t("... and other commands which have been disabled"))
|
||||||
|
}
|
||||||
|
|
||||||
// sort help lines
|
// sort help lines
|
||||||
sort.Sort(shownHelpLines)
|
sort.Sort(shownHelpLines)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user