Beispiel #1
0
        public async Task EvalFct(params string[] args)
        {
            await p.DoAction(Context.User, Context.Guild.Id, Program.Module.Settings);

            if (Context.User.Id != Base.Sentences.ownerId)
            {
                await ReplyAsync(Base.Sentences.OnlyMasterStr(Context.Guild.Id));
            }
            else if (args.Length == 0)
            {
                await ReplyAsync(Sentences.EvalHelp(Context.Guild.Id));
            }
            else
            {
                Interpreter interpreter = new Interpreter()
                                          .SetVariable("Context", Context)
                                          .SetVariable("p", Program.p)
                                          .EnableReflection();
                try
                {
                    await ReplyAsync(interpreter.Eval(string.Join(" ", args)).ToString());
                }
                catch (Exception e)
                {
                    await ReplyAsync(Sentences.EvalError(Context.Guild.Id, e.Message));
                }
            }
        }