PageRenderTime 47ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/UserActions.php

https://bitbucket.org/sean111/ebot
PHP | 103 lines | 103 code | 0 blank | 0 comment | 6 complexity | 916dd4664c6ba81dbeae1fd499db8537 MD5 | raw file
  1. <?php
  2. Class UserActions extends eBot {
  3. public function run($buffer) {
  4. $bArray=explode(" ",$buffer['text']);
  5. switch($bArray[0]) {
  6. case "!endrey": {
  7. $this->endrey($buffer, $bArray);
  8. }
  9. break;
  10. case "!bane": {
  11. $this->bane($buffer);
  12. }
  13. break;
  14. case "!sean": {
  15. $this->sean($buffer);
  16. }
  17. break;
  18. case ".-": {
  19. $this->dotDash($buffer);
  20. }
  21. break;
  22. case "!goody": {
  23. $this->goody($buffer);
  24. }
  25. break;
  26. case "!gnu": {
  27. $this->gnu($buffer);
  28. }
  29. break;
  30. case "!who": {
  31. $this->who($buffer);
  32. }
  33. break;
  34. case "!ni": {
  35. $this->swallow($buffer);
  36. }
  37. break;
  38. case "!reboot": {
  39. $this->reboot($buffer);
  40. }
  41. break;
  42. }
  43. }
  44. private function endrey($buffer, $bArray) {
  45. $r=$bArray[1];
  46. settype($r,'int');
  47. $r=abs($r);
  48. $data=file_get_contents("endrey.txt");
  49. $data=explode("\n",$data);
  50. $data=array_filter($data);
  51. if(empty($r)) {
  52. $r=mt_rand(0,sizeof($data)-1);
  53. }
  54. else {
  55. $r--;
  56. }
  57. if($r>sizeof($data)) {
  58. $this->send("PRIVMSG $buffer[channel] :Sorry that number is too high\n");
  59. }
  60. else {
  61. $this->send("PRIVMSG $buffer[channel] :[".($r+1)."] ".$data[$r]."\n");
  62. }
  63. unset($data, $r, $num);
  64. }
  65. private function bane($buffer) {
  66. $this->send("PRIVMSG $buffer[channel] :AHHHHH! A baneling!\n");
  67. $this->send("PART $buffer[channel]\n");
  68. sleep(5);
  69. $this->send("JOIN $buffer[channel]\n");
  70. sleep(1);
  71. $this->send("PRIVMSG $buffer[channel] :".chr(1)."ACTION looks around\n");
  72. $this->send("PRIVMSG $buffer[channel] :Is it gone?\n");
  73. }
  74. private function sean($buffer) {
  75. $string="Not the Mama! ";
  76. if($this->inChannel('bane',$buffer['channel']) || $this->inChannel('bane_',$buffer['channel'])) {
  77. $string.=" *looks at bane* the Mama!!";
  78. }
  79. $this->send("PRIVMSG $buffer[channel] :$string\n");
  80. }
  81. private function dotDash($buffer) {
  82. $this->send("PRIVMSG $buffer[channel] :()()\n");
  83. $this->send("PRIVMSG $buffer[channel] :( ^.^)\n");
  84. $this->send("PRIVMSG $buffer[channel] :((\")\")\n");
  85. }
  86. private function goody($buffer) {
  87. $this->send("PRIVMSG $buffer[channel] :Sorry but we failed to get in contact with Goody. None of our SCVs could get through his tank shell\n");
  88. }
  89. private function gnu($buffer) {
  90. $this->send("PRIVMSG $buffer[channel] :".chr(1)."ACTION looks confused\n");
  91. $this->send("PRIVMSG $buffer[channel] :who?\n");
  92. }
  93. private function who($buffer) {
  94. $this->send("PRIVMSG $buffer[channel] :Who's on first\n");
  95. }
  96. private function swallow($buffer) {
  97. $this->send("PRIVMSG $buffer[channel] :Ekki-Ekki-Ekki-Ekki-PTANG. Zoom-Boing. Z'nourrwringmm\n");
  98. }
  99. private function reboot($buffer) {
  100. $this->send("PRIVMSG $buffer[channel] :I'm sorry, $buffer[nickname]. I'm afraid I can't do that.\n");
  101. }
  102. }
  103. ?>