PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/chatbot.php

https://github.com/Arceius/RPG-Triggers
PHP | 175 lines | 144 code | 15 blank | 16 comment | 5 complexity | cf5457b48b220b78959b66f419c39044 MD5 | raw file
  1. <?php
  2. switch (true) {
  3. // BEGIN responses PRIVATE
  4. case stristr($text,"help me"):
  5. $this->insertChatBotMessage($this->getPrivateMessageID(),"If you're looking for help, start by contacting our [url=http://www.roleplaygateway.com/memberlist.php?mode=group&g=2625]Global Moderators[/url] (GMs for short).");
  6. break;
  7. case (strlen($text) >= 512):
  8. $this->insertChatBotMessage($this->getPrivateMessageID(),"Please don't forget that the chat is for shorter and faster-paced roleplay, while the forum is for the longer and more descriptive posts. If you keep your chat messages between one and two sentences, that lets other people interact with you more frequently, making for a better roleplay! Then everyone doesn't have to wait so long for posts.");
  9. break;
  10. // BEGIN responses PUBLIC
  11. /*case stristr($text,"!quote"):
  12. $sql = 'SELECT author,text FROM rpg_quotes ORDER BY rand() LIMIT 1';
  13. $result = $db->sql_query($sql);
  14. $quote = $db->sql_fetchrow($result);
  15. $db->sql_freeresult($result);
  16. $this->insertChatBotMessage($this->getChannel(),'[quote="'.$quote['author'].'"]'.$quote['text'].'[/quote]');
  17. break;*/
  18. case preg_match('/I((\'?m)|( am))(.*)bored/i',$text):
  19. $this->insertChatBotMessage($this->getPrivateMessageID(),"Boredom is a sign of one's inability to be imaginative! Go [url=http://www.roleplaygateway.com/roleplay/]browse open roleplays[/url] or [url=http://www.roleplaygateway.com/ucp.php?i=roleplays&mode=new]create a new one[/url].");
  20. break;
  21. case preg_match('/(.*)chat d((ea)|(ie))d(.*)/i',$text):
  22. $this->insertChatBotMessage($this->getChannel(),"No, chat isn't dead. People are just busy [url=http://www.roleplaygateway.com/viewonline.php]roleplaying[/url].");
  23. break;
  24. case stristr($text,"!grammar"):
  25. $this->insertChatBotMessage($this->getChannel(),"Please be respectful of our adult sanity and use proper grammar. If you don't, we have a hard time understanding what you're trying to say.");
  26. break;
  27. /* case stristr($text,"!kris"):
  28. $this->insertChatBotMessage($this->getChannel(),"Our long time friend and GM [b]kris0the0girl[/b] has left RolePlayGateway to go away to nursing school, handle work, and enjoy her upcoming marriage. [url=http://www.youtube.com/watch?v=wYU11zNUhNI]Watch the video[/url] and send her your support and best wishes!");
  29. break; */
  30. case stristr($text,"!question"):
  31. $this->insertChatBotMessage($this->getChannel(),"So you want to ask a question? Don't ask to ask, just [b]ask[/b]!");
  32. break;
  33. /* case stristr($text,"!9000"):
  34. $this->insertChatBotMessage($this->getChannel(),"[img]http://www.roleplaygateway.com/images/over_9000.gif[/img]");
  35. break; */
  36. /* case stristr($text,"!troll"):
  37. $this->insertChatBotMessage($this->getChannel(),"[url=http://www.youtube.com/watch?v=6bMLrA_0O5I][img]http://i195.photobucket.com/albums/z91/Pheloz/boxxy-trolling.jpg[/img][/url]");
  38. break; */
  39. case stristr($text,"!newuser"):
  40. $this->insertChatBotMessage($this->getChannel(),"As a new user, you should check out the following links: \n- [url=http://www.roleplaygateway.com/the-official-roleplaygateway-rules-t1369.html]RPG Rules[/url] (we only have five!)\n- [url=http://www.roleplaygateway.com/role-play-academy-f125.html]The RolePlayAcademy[/url]: great for roleplaying help!\n- [url=http://www.roleplaygateway.com/help-f11.html]The Help Forum[/url] - useful for getting answers to specific questions.\n- [url=http://www.roleplaygateway.com/simple-beginner-guide-roleplaygateway-chat-system-t32024.html]The Beginner's guide to RPG Chat[/url]: explains the special roleplaying features in this chat.");
  41. break;
  42. /* case stristr($text,"!thegame"):
  43. $this->insertChatBotMessage($this->getChannel(),"[url=http://epicponyz.files.wordpress.com/2009/06/sorry-you-just-lost-the-game.jpg]You lost it.[/url]");
  44. break; */
  45. /* case stristr($text,"!barrelroll"):
  46. $this->insertChatBotMessage($this->getChannel(),"[img]http://rookery5.aviary.com/storagev12/3392500/3392668_3894_625x625.jpg[/img]");
  47. break; */
  48. /* case stristr($text,"!sad"):
  49. $this->insertChatBotMessage($this->getChannel(),"Awesomeness: When you get sad, [i]stop[/i] being sad and [b]be awesome instead[/b].\n[img]http://www.roleplaygateway.com/images/motivationals/awesomeness.jpg[/img]");
  50. break; */
  51. case stristr($text,"!feedback"):
  52. $this->insertChatBotMessage($this->getChannel(),"Please direct all feedback/suggestions to [url=http://rpg.uservoice.com]our feedback forum[/url]; we [i]love[/i] to hear them, but we aren't fast enough to handle everyone's suggestions in chat.");
  53. break;
  54. case stristr($text,"!autocomplete"):
  55. $this->insertChatBotMessage($this->getChannel(),"If you want someone's attention, make sure to include their [b]full name[/b] in your message [u][b]and[/b] include the question/statement[/u]. This highlights the line on their screen and makes it so once you have their attention, they don't have to wait to find out what you actually want from them. You can type the first few letters in their name and hit [TAB] to automatically put it in your chat box, or just click the name on one of their messages to insert it.");
  56. break;
  57. case stristr($text,"!occ"):
  58. $this->insertChatBotMessage($this->getChannel(),"Make sure you use the acronym 'OOC' correctly! [b]O[/b]ut [b]O[/b]f [b]C[/b]haracter (OOC). The other word, 'OCC', actually means [b]O[/b]riginal [b]C[/b]anon [b]C[/b]haracter, something completely different.");
  59. break;
  60. case stristr($text,"!hor"):
  61. $this->insertChatBotMessage($this->getChannel(),"[url=http://www.thegrandtournament.com]The Hall of Records (HoR)[/url] is the permenent repository for the results of text-based fighting. Every two years, the top fighters from this recordkeeper are invited to \"The Grand Tournament\" to determine who is the internet's best fighter.");
  62. break;
  63. case stristr($text,"!eve"):
  64. $this->insertChatBotMessage($this->getChannel(),"EVE Online is an MMORPG that doesn't have levels or experience points (no grinding!) - it focuses on [url=http://www.youtube.com/watch?v=08hmqyejCYU]'emergent' gameplay (YouTube Video)[/url] and actual (!) roleplay. You can play with Remaeus on a [url=https://secure.eve-online.com/ft/?aid=103657]free 14 day trial[/url], or [url=http://www.roleplaygateway.com/ucp.php?i=pm&mode=compose&u=4]send him a PM[/url] to see if he has any 21 day trials available. [b]If you already play, join the in-game channel \"RolePlayGateway\". Instructions, guide, and discussion is available in the [url=http://www.roleplaygateway.com/the-official-eve-online-thread-t43588.html]Official EVE Online Thread[/url].[/b]");
  65. break;
  66. case stristr($text,"!last.fm"):
  67. $this->insertChatBotMessage($this->getChannel(),"RolePlayGateway can be found on [url=http://last.fm]Last.fm[/url], you should join the [url=http://www.last.fm/group/RolePlay+Gateway]RolePlayGateway group on Last.fm[/url]! (You can also [url=http://last.fm/user/Remaeus/]spy on the site owner's listening habits[/url] and make fun of his music selection)");
  68. break;
  69. case stristr($text,"!facebook"):
  70. $this->insertChatBotMessage($this->getChannel(),"RolePlayGateway can be found on [url=http://www.facebook.com]Facebook[/url], you should [url=http://www.facebook.com/pages/RolePlayGateway/27605290251]become a fan of RolePlayGateway[/url]!");
  71. break;
  72. case stristr($text,"!meetup"):
  73. $this->insertChatBotMessage($this->getChannel(),"Interested in meeting up with fellow RolePlayGateway members? Register on [url=http://www.meetup.com/RolePlayGateway/]our meetup group[/url] to get notified of any earth-shattering parties that we're having.");
  74. break;
  75. case stristr($text,"!twitter"):
  76. $this->insertChatBotMessage($this->getChannel(),"Hey, Twitter! Come follow [url=http://twitter.com/RolePlayGateway]RolePlayGateway on Twitter[/url]!");
  77. break;
  78. case stristr($text,"!myspace"):
  79. $this->insertChatBotMessage($this->getChannel(),"Can has MySpaces? If you're one of the [url=http://siteanalytics.compete.com/facebook.com+myspace.com/]stubborn few[/url] still using MySpace, you can [url=http://groups.myspace.com/index.cfm?fuseaction=groups.groupProfile&groupID=105745464]join RolePlayGateway's MySpace group.[/url]");
  80. break;
  81. case stristr($text,"!youtube"):
  82. $this->insertChatBotMessage($this->getChannel(),"If you've got an account on YouTube, you can [url=http://www.youtube.com/group/roleplaygateway]join the RolePlayGateway group[/url] and share your favorite videos with everyone, or even post videos you've made.");
  83. break;
  84. case stristr($text,"!googleplus"):
  85. $this->insertChatBotMessage($this->getChannel(),"An [url=http://www.roleplaygateway.com/google-invitations-and-profiles-t63266.html]official list of RPG users on Google+[/url] is available.");
  86. break;
  87. case stristr($text,"!github"):
  88. $this->insertChatBotMessage($this->getChannel(),"Explore our public source code on [url=http://github.com/RolePlayGateway]the RolePlayGateway GitHub[/url], and feel free to submit a pull request with changes, and you never know--[b]you[/b] might be the next Coder!");
  89. break;
  90. case stristr($text,"!google"):
  91. unset($textParts[0]);
  92. $searchText = implode("+",$textParts);
  93. $searchText = $this->removeBBCode($searchText);
  94. $searchText = preg_replace("/\[\/color]/","",$searchText);
  95. $engineStrings[] = 'http://lmgtfy.com/?q='.$searchText;
  96. $engineStrings[] = 'http://www.dinoogle.com/results/?cx=000479422399193962880:wnemoiokw0a&cof=FORID:10&ie=UTF-8&q='.$searchText.'&sa=Search';
  97. $engineStrings[] = 'http://www.google.com/?q='.$searchText;
  98. $engineKey = array_rand($engineStrings);
  99. $this->insertChatBotMessage($this->getChannel(),"Before asking questions of anyone, make sure you ask Google first. ([url=".$engineStrings[$engineKey]."]direct link to search results here![/url])");
  100. break;
  101. case stristr($text,"!latex"):
  102. unset($textParts[0]);
  103. $latexCode = implode(" ",$textParts);
  104. $latexCode = preg_replace("/\[\/color]/","",$latexCode);
  105. $this->insertChatBotMessage($this->getChannel(),"[img]http://latex.codecogs.com/gif.latex?".$latexCode."[/img]");
  106. break;
  107. case stristr($text,"!advertising"):
  108. $this->insertChatBotMessage($this->getChannel(),"We not only allow advertising here, but we [i]encourage[/i] it. Our goal is to help other sites grow, too. Just make sure you're not spamming; post it in the [url=http://www.roleplaygateway.com/directory/]RPG Directory[/url]!");
  109. break;
  110. case stristr($text,"gt league"):
  111. $this->insertChatBotMessage($this->getChannel(),"Please remember that the GT League no longer exists; it ended after Season 2. It has been replaced with the [url=http://www.thegrandtournament.com]Hall of Records[/url], and [b]all[/b] turn-based fights can be recorded there, no matter how old they are.");
  112. break;
  113. case stristr($text,"new account"):
  114. $this->insertChatBotMessage($this->getChannel(),"Please don't make multiple accounts; it's not against our rules, but it works much better when you [url=http://www.roleplaygateway.com/ucp.php?i=characters&mode=new]create your characters[/url] all on one account. If you need multiple accounts merged or other account help, [url=http://www.roleplaygateway.com/memberlist.php?mode=group&g=2626]PM the Administrator group[/url] and we will help you.");
  115. break;
  116. case stristr($text,"Connection status: 500"):
  117. $this->insertChatBotMessage($this->getChannel(),"Error 500 means that you were checking the server for messages at the [i]exact[/i] time that the config was being updated. Just type any command (like [code]/list[/code] and you will automatically reconnect.");
  118. break;
  119. case stristr($text,"Connection status: 0"):
  120. $this->insertChatBotMessage($this->getChannel(),"Error 0 means that the server has gone away. Just type any command (like [code]/list[/code]) and you will automatically reconnect.");
  121. break;
  122. case stristr($text,"pen the pod bay doors"):
  123. $this->insertCustomMessage($this->getConfig('chatBotID'), 'HAL', AJAX_CHAT_CHATBOT, $this->getChannel(), "I'm sorry, I can't do that right now." );
  124. break;
  125. /* // BEGIN HAL
  126. case stristr($text,'HAL'):
  127. break; */
  128. }
  129. /**
  130. * This function passes our data to NuSOAP, and
  131. * returns the search results:
  132. */
  133. function getResultArray($id, $site, $baseurl) {
  134. // Get the parameters:
  135. //$params = setParams($id, $site);
  136. return false;
  137. // Include the library:
  138. include_once("libs/nusoap.php");
  139. // Create a instance of the SOAP client object
  140. $soapclient = new soapclient($baseurl);
  141. $data = $soapclient->call("doGoogleSearch", $params,
  142. "urn:GoogleSearch", "urn:GoogleSearch");
  143. return $data;
  144. }
  145. ?>