Created
April 10, 2016 06:11
-
-
Save luuhq/61064ecbd982f1e4d0974c9fe492ee44 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Message Post([FromBody]Message message) | |
{ | |
const string NotSupportMessage = "Sorry, I could not understand that."; | |
if (message.Type == "Message") | |
{ | |
Command command = null; | |
if (Command.TryParse(message.Text, out command) == false) | |
{ | |
return message.CreateReplyMessage(NotSupportMessage); | |
} | |
switch (command.Action) | |
{ | |
case "add": | |
return HandleAddCommand(command, message); | |
default: | |
return message.CreateReplyMessage(NotSupportMessage); | |
} | |
} | |
else | |
{ | |
return HandleSystemMessage(message); | |
} | |
} | |
private Message HandleAddCommand(Command command, Message message) | |
{ | |
return message.CreateReplyMessage("Not sure what I should do with an 'add' command yet"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment