CustomChat v2

Un script pour customiser la shoutbox de PMT !

  1. // ==UserScript==
  2. // @name CustomChat v2
  3. // @description Un script pour customiser la shoutbox de PMT !
  4. // @include https://realitygaming.fr/
  5. // @include https://realitygaming.fr/
  6. // @include https://realitygaming.fr/
  7. // @include https://realitygaming.fr/
  8. // @include https://realitygaming.fr/chatbox/
  9. // @include https://realitygaming.fr/chatbox/
  10. // @include https://realitygaming.fr/chatbox/
  11. // @include https://realitygaming.fr/chatbox/
  12. // @version 2.0
  13. // @grant none
  14. // @namespace https://greatest.deepsurf.us/users/47201
  15. // ==/UserScript==
  16.  
  17. function chatBot() {
  18. // current user input
  19. this.input;
  20. /**
  21. * respondTo
  22. *
  23. * return nothing to skip response
  24. * return string for one response
  25. * return array of strings for multiple responses
  26. *
  27. * @param input - input chat string
  28. * @return reply of chat-bot
  29. */
  30. this.respondTo = function(input) {
  31. this.input = input.toLowerCase();
  32. if(this.match('(hi|hello|hey|hola|howdy)(\\s|!|\\.|$)'))
  33. return "um... hi?";
  34. if(this.match('what[^ ]* up') || this.match('sup') || this.match('how are you'))
  35. return "this github thing is pretty cool, huh?";
  36. if(this.match('l(ol)+') || this.match('(ha)+(h|$)') || this.match('lmao'))
  37. return "what's so funny?";
  38. if(this.match('^no+(\\s|!|\\.|$)'))
  39. return "don't be such a negative nancy :(";
  40. if(this.match('(cya|bye|see ya|ttyl|talk to you later)'))
  41. return ["alright, see you around", "good teamwork!"];
  42. if(this.match('(dumb|stupid|is that all)'))
  43. return ["hey i'm just a proof of concept", "you can make me smarter if you'd like"];
  44. if(this.input == 'noop')
  45. return;
  46. return input + " what?";
  47. }
  48. /**
  49. * match
  50. *
  51. * @param regex - regex string to match
  52. * @return boolean - whether or not the input string matches the regex
  53. */
  54. this.match = function(regex) {
  55. return new RegExp(regex).test(this.input);
  56. }
  57. }