Skip to content

Instantly share code, notes, and snippets.

@luuhq
Created April 10, 2016 06:11
Show Gist options
  • Save luuhq/61064ecbd982f1e4d0974c9fe492ee44 to your computer and use it in GitHub Desktop.
Save luuhq/61064ecbd982f1e4d0974c9fe492ee44 to your computer and use it in GitHub Desktop.
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