public override IEnumerable <CommandNode> Register() { var quote = new LiteralNode("rule", new CommandMetaData(1)); quote.NextLiteral("add") .NextArgument("text", new LongStringArgument()) .ThisCalls(AddRule); quote.NextLiteral("remove") .NextArgument("num", new IntArgument()) .ThisCalls(RemoveRule); quote.NextLiteral("list") .ThisCalls(ListRules); quote.NextLiteral("make-sticky-post") .ThisCalls(PlaceRules); quote.NextLiteral("show") .NextArgument("num", new IntArgument()) .ThisCalls(SingleRule); return(new[] { quote }); }
public override IEnumerable <CommandNode> Register() { var quote = new LiteralNode("server", new CommandMetaData(1)); quote.NextLiteral("setup") .ThisCalls(ServerSetup); /* * return l.Literal("server") * .Then(s => * s.Literal("setup") * .Executes(AsyncExecue(ServerSetup)) * ) * .Then(p=> * p.Literal("role") * .Then(a=> a.Literal("add") * .Then( a=> a.Argument("level",Arguments.String()) * .Then(b=> b.Argument("role",DiscordArgumentTypes.Role()) * .Executes(SetRole) * ) * ) * ) * .Then(a=> a.Literal("remove") * .Then( a=> a.Argument("level",Arguments.String()) * .Then(b=> b.Argument("role",DiscordArgumentTypes.Role()) * .Executes(RemoveRole) * ) * ) * ) * ); */ return(null); }
public override IEnumerable <CommandNode> Register() { var quote = new LiteralNode("quote", new CommandMetaData(1)); //#### ADD ###### var add = quote.NextLiteral("add"); add.NextLiteral("anonymous") .NextArgument("text", new LongStringArgument()) .ThisCalls(new CommandFunction(AddQuote)); add.NextLiteral("from") .NextArgument("source", DiscordArgumentTypes.User()) .NextArgument("text", new LongStringArgument()) .ThisCalls(new CommandFunction(AddQuote)); add.NextLiteral("repl") .ThisCalls(AddQuote); //#### LIST ###### var list = quote.NextLiteral("get"); list.NextLiteral("all").ThisCalls(new CommandFunction(ListQuotes)); //#### Specific number ###### list.NextLiteral("num").NextArgument("number", new IntArgument()).ThisCalls(new CommandFunction(PrintQuote)); //#### REMOVE ###### var remove = quote.NextLiteral("remove"); remove.NextArgument("id", new IntArgument()).ThisCalls(new CommandFunction(RemoveQuote)); return(new[] { quote }); }