// Lists details for a specific command, if the user has permission, in the given package
Lists details for a specific command, if the user has permission, in the given package
// Lists details for a specific command if the user has permission in the given package
func (hc *HelpCommand) listCommandDetails(pack *CommPackage) {
	requestedCommandKey := strings.ToUpper(pack.params[0])
	for _, command := range hc.Commands() {
		if !hc.currentUserHasCommandPermission(pack, command) {
			continue
		}
		for _, commandKey := range command.GetCommandKeys() {
			if commandKey == requestedCommandKey {
				var message strings.Builder
				message.WriteString("**Details for command**: `")
				message.WriteString(util.ForceTitleCase(commandKey))
				message.WriteString("`:\n")
				message.WriteString(command.GetCommandHelp(hc.ComPrefix))
				pack.session.ChannelMessageSend(pack.channel.ID, message.String())
				return
			}
		}
	}
	hc.listAllCommands(pack)
}
func ( hc * HelpCommand ) listCommandDetails ( pack * CommPackage ) { requestedCommandKey := strings . ToUpper ( pack . params [ 0 ] ) for _ , command := range hc . Commands ( ) { if ! hc . currentUserHasCommandPermission ( pack , command ) { continue } for _ , commandKey := range command . GetCommandKeys ( ) { if commandKey == requestedCommandKey { var message strings . Builder message . WriteString ( " " ) message . WriteString ( util . ForceTitleCase ( commandKey ) ) message . WriteString ( " \n " ) message . WriteString ( command . GetCommandHelp ( hc . ComPrefix ) ) pack . session . ChannelMessageSend ( pack . channel . ID , message . String ( ) ) return } } } hc . listAllCommands ( pack ) }
Lists details for a specific command, if the user has permission, in the given package
Lists details for a specific command if the user has permission in the given package
// Skip any commands which the user doesn't have access to // Getting to this point means we didn't find the message. List all commands