예제 #1
0
    public IProcessingResult Modules(IBot bot, IProcessingResult pr)
    {
        pr.Solved         = true;
        pr.Respond        = true;
        pr.ResponseOrigin = Helper.GetExecutingMethodName(this);


        // get all module files and their build date

        var modules = bot.GetLoadedModules();

        if (modules.Count < 1)
        {
            pr.ResponseText = "No modules loaded. This is very bad.";
            return(pr);
        }

        var ret = "List of " + modules.Count + " loaded modules (name − build date):" + Environment.NewLine;

        foreach (var module in modules)
        {
            ret += module.Name + " − " + module.BuildDate + Environment.NewLine;
        }



        pr.ResponseText = ret;
        return(pr);
    }
예제 #2
0
    public IProcessingResult GetCommandList(IBot bot, IProcessingResult pr, string arg)
    {
        pr.Solved         = true;
        pr.Respond        = true;
        pr.ResponseOrigin = Helper.GetExecutingMethodName(this);

        var modules          = bot.GetLoadedModules();
        var commandsByModule = new Dictionary <string, List <string> >();

        foreach (var module in modules)
        {
            commandsByModule[module.Name] = new List <string>();

            foreach (var command in module.CommandList)
            {
                commandsByModule[module.Name].Add(command);
            }
        }

        if (modules.Count > 0)
        {
            string reply = "";

            foreach (var module in commandsByModule)
            {
                reply += "[" + module.Key + "] " + string.Join(", ", module.Value) + Environment.NewLine;
            }

            pr.ResponseText = reply;
        }
        else
        {
            pr.ResponseText = "No modules are currently loaded.";
        }

        return(pr);
    }
예제 #3
0
    public IProcessingResult Modules(IBot bot, IProcessingResult pr)
    {
        pr.Solved = true;
        pr.Respond = true;
        pr.ResponseOrigin = Helper.GetExecutingMethodName(this);


        // get all module files and their build date

        var modules = bot.GetLoadedModules();

        if (modules.Count < 1)
        {
            pr.ResponseText = "No modules loaded. This is very bad.";
            return pr;
        }

        var ret = "List of " + modules.Count + " loaded modules (name − build date):" + Environment.NewLine;
        foreach (var module in modules)
            ret += module.Name + " − " + module.BuildDate + Environment.NewLine;



        pr.ResponseText = ret;
        return pr;
    }
예제 #4
0
    public IProcessingResult GetCommandList(IBot bot, IProcessingResult pr, string arg)
    {
        pr.Solved = true;
        pr.Respond = true;
        pr.ResponseOrigin = Helper.GetExecutingMethodName(this);

        var modules = bot.GetLoadedModules();
        var commandsByModule = new Dictionary<string, List<string>>();

        foreach (var module in modules)
        {
            commandsByModule[module.Name] = new List<string>();

            foreach (var command in module.CommandList)
                commandsByModule[module.Name].Add(command);
        }

        if (modules.Count > 0)
        {
            string reply = "";

            foreach (var module in commandsByModule)
                reply += "[" + module.Key + "] " + string.Join(", ", module.Value) + Environment.NewLine;

            pr.ResponseText = reply;
        }
        else
            pr.ResponseText = "No modules are currently loaded.";

        return pr;
    }