func cmdUser(ctx Ctx) {
	if cmd, found := ctx.commands[ctx.messageCmd]; found {
		go func() {
			if ctx.appConfig.oneThread {
				ctx.oneThreadMutex.Lock()
			}
			replayMsgRaw := execShell(
				cmd.shellCmd,
				ctx.messageArgs,
				ctx.commands[ctx.messageCmd].vars,
				ctx.userID,
				ctx.chatID,
				ctx.users.list[ctx.userID].UserName,
				ctx.users.list[ctx.userID].FirstName+" "+ctx.users.list[ctx.userID].LastName,
				ctx.cache,
				ctx.cacheTTL,
				ctx.appConfig,
			)
			if ctx.appConfig.oneThread {
				ctx.oneThreadMutex.Unlock()
			}
			sendMessage(ctx.messageSignal, ctx.chatID, replayMsgRaw, cmd.isMarkdown)
		}()
	}
}
all commands from command-line
package main
import (
	"fmt"
	"log"
	"sort"
	"strings"
	"sync"
	"github.com/msoap/raphanus"
)
type Ctx struct {
	appConfig      *Config            
	users          *Users             
	commands       Commands           
	userID         int                
	allowExec      bool               
	messageCmd     string             
	messageArgs    string             
	messageSignal  chan<- BotMessage  
	chatID         int                
	exitSignal     chan<- struct{}    
	cache          *raphanus.DB       
	cacheTTL       int                
	oneThreadMutex *sync.Mutex        
}
func cmdAuth(ctx Ctx) (replayMsg string) {
	forRoot := ctx.messageCmd == "/authroot"
	if ctx.messageArgs == "" {
		replayMsg = "See code in terminal with shell2telegram or ask code from root user and type:\n" + ctx.messageCmd + " code"
		authCode := ctx.users.DoLogin(ctx.userID, forRoot)
		rootRoleStr := ""
		if forRoot {
			rootRoleStr = "root "
		}
		secretCodeMsg := fmt.Sprintf("Request %saccess for %s. Code: %s\n", rootRoleStr, ctx.users.String(ctx.userID), authCode)
		fmt.Print(secretCodeMsg)
		ctx.users.BroadcastForRoots(ctx.messageSignal, secretCodeMsg, 0)
	} else {
		if ctx.users.IsValidCode(ctx.userID, ctx.messageArgs, forRoot) {
			ctx.users.SetAuthorized(ctx.userID, forRoot)
			if forRoot {
				replayMsg = fmt.Sprintf("You (%s) authorized as root.", ctx.users.String(ctx.userID))
				log.Print("root authorized: ", ctx.users.String(ctx.userID))
			} else {
				replayMsg = fmt.Sprintf("You (%s) authorized.", ctx.users.String(ctx.userID))
				log.Print("authorized: ", ctx.users.String(ctx.userID))
			}
		} else {
			replayMsg = fmt.Sprintf("Code is not valid.")
		}
	}
	return replayMsg
}
func cmdHelp(ctx Ctx) (replayMsg string) {
	helpMsg := []string{}
	if ctx.allowExec {
		for cmd, shellCmdRow := range ctx.commands {
			description := shellCmdRow.description
			if description == "" {
				description = shellCmdRow.shellCmd
			}
			helpMsg = append(helpMsg, cmd+" → "+description)
		}
	}
	sort.Strings(helpMsg)
	if !ctx.appConfig.isPublicBot {
		helpMsg = append(helpMsg,
			"/auth [code] → authorize user",
			"/authroot [code] → authorize user as root",
		)
	}
	if ctx.users.IsRoot(ctx.userID) {
		helpMsgForRoot := []string{
			"/shell2telegram ban <user_id|username> → ban user",
			"/shell2telegram broadcast_to_root <message> → send message to all root users in private chat",
			"/shell2telegram desc <bot description> → set bot description",
			"/shell2telegram message_to_user <user_id|username> <message> → send message to user in private chat",
			"/shell2telegram rm </command> → delete command",
			"/shell2telegram search <query> → search users by name/id",
			"/shell2telegram stat → get stat about users",
			"/shell2telegram version → show version",
		}
		if ctx.appConfig.addExit {
			helpMsgForRoot = append(helpMsgForRoot, "/shell2telegram exit → terminate bot")
		}
		sort.Strings(helpMsgForRoot)
		helpMsg = append(helpMsg, helpMsgForRoot...)
	}
	if ctx.appConfig.description != "" {
		replayMsg = ctx.appConfig.description
	} else {
		replayMsg = "This bot created with shell2telegram"
	}
	replayMsg += "\n\n" +
		"available commands:\n" +
		strings.Join(helpMsg, "\n")
	return replayMsg
}