simple_say.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using System.Text.RegularExpressions;
  5. using System.Net.ApiService;
  6. namespace Speech {
  7. static class simple_say {
  8. [Route("/say.cgi")]
  9. public static object Say(RequestHeader r) {
  10. if (!String.IsNullOrEmpty(r.Request("say"))) {
  11. System.Diagnostics.Debug.WriteLine("I try to say: " + r.Query["say"]);
  12. if (!String.IsNullOrEmpty(r.Request("mood"))) {
  13. SpeechExecute.Say(r.Request("say"));
  14. } else {
  15. SpeechExecute.Say(r.Request("say"));
  16. }
  17. return new Leah.SayResponse("ok", "");
  18. } else {
  19. System.Diagnostics.Debug.WriteLine("I try to say: ");
  20. return new Leah.SayResponse("failed", "");
  21. }
  22. }
  23. [Route("test.html")]
  24. public static string test(RequestHeader r) {
  25. return "<html><head><title>Test</title></head><body>Hallo <strong>du</strong> da</body></html>";
  26. }
  27. [Route("say_([a-zA-Z0-9_]+).cgi")]
  28. public static object SayIt(RequestHeader r, Match mc) {
  29. System.Diagnostics.Debug.WriteLine("SayIt: " + mc.Groups[1].Value);
  30. return new Leah.SayResponse("ok","");
  31. }
  32. /*[Route("topic.cgi")]
  33. public static string topic(RequestHeader r) {
  34. string t = r.Request("topic");
  35. string m = r.Request("mood");
  36. if (t != "") {
  37. string res = "";
  38. return res;
  39. }
  40. }*/
  41. }
  42. }