Exemple #1
0
        public void TestMultiParameter()
        {
            string input = @"!join vorago ""Lut son"" ";

            var userCommandInput = InputCommandLexer.ToCommandInput(input);

            Assert.AreEqual('!', userCommandInput.FirstToken);
            Assert.AreEqual("join", userCommandInput.Name);
            string[] expectedParams = { "vorago", "Lut son" };
            Assert.AreEqual(expectedParams[0], userCommandInput.Parameters[0]);
            Assert.AreEqual(expectedParams[1], userCommandInput.Parameters[1]);
        }
Exemple #2
0
        private async Task MessageReceived(SocketMessage messageSocket)
        {
            //TO DO: Create DiscordManagerClasses for channels & messages
            var content = messageSocket.Content;

            var parsedInput = InputCommandLexer.ToCommandInput(content);

            if (parsedInput.FirstToken != this.commandManager.CommandToken)
            {
                return;
            }

            var command = this.commandManager.FindCommand(parsedInput.Name);

            command.Execute(parsedInput.Parameters);

            await messageSocket.Channel.SendMessageAsync(command.PrintOutput());
        }