kyroskoh

Random Slap script for Nightbot

Oct 21st, 2020 (edited)
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?php
  2. // Set names to lowercase for URL injection.
  3. $ToLower = strtolower($_GET["To"]);
  4. $BroadcasterLower = strtolower($_GET["Broadcaster"]);
  5. // Inject lowercase names to get correct capitalization of usernames.
  6. //$ch = curl_init("https://api.twitch.tv/kraken/channels/" . $ToLower);
  7. //curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  8. //$result = curl_exec($ch);
  9. curl_close($ch);
  10. // Decode the above JSON data.
  11. //$ToCorrectName = json_decode($result, true);
  12. // No name was entered after the command.
  13. if (empty($_GET["To"]))
  14. {
  15. echo 'Hey ' . htmlspecialchars($_GET["From"]) . ' if you want to slap someone, you need to tell me who you wish to slap!';
  16. die();
  17. }
  18. // No such Twitch user exists, yet.
  19. //if($ToCorrectName['display_name'] == null)
  20. //{
  21. // echo 'Sorry, ' . htmlspecialchars($_GET["From"]) . ', ' . htmlspecialchars($_GET["To"]) . ' isn\'t a Twitch streamer!';
  22. // die();
  23. //}
  24. // Tried to slap the broadcaster.
  25. if ($ToLower == $BroadcasterLower)
  26. {
  27. echo htmlspecialchars($_GET["From"]) . ' has just tried to slap ' . $ToLower . '! We can\'t allow that, now can we?';
  28. die();
  29. }
  30. // Tried to commit suicide.
  31. elseif ($_GET["To"] == $_GET["From"])
  32. {
  33. echo 'Well, this is awkward... ' . $ToLower . ' appeara to love to slap himself/herself';
  34. die();
  35. }
  36. // Tried to slap a bot, I know there's many more, add to suit yourself.
  37. elseif ($ToLower == 'nightbot' || $ToLower == 'wizebot' || $ToLower == 'moobot' || $ToLower == 'streamlabs' || $ToLower == 'streamelements')
  38. {
  39. echo 'One does not simply slap a bot!';
  40. die();
  41. }
  42. // The kill methods array.
  43. $Methods = array
  44. (
  45. "with a large trout!",
  46. "with a sumo wrestler!",
  47. "with an elephant!"
  48. );
  49.  
  50. // Count the array size, and return a ranodm entry from the array.
  51. $SlapMethod = $Methods[mt_rand(0, count($Methods) - 1)];
  52. // Print the output.
  53. echo htmlspecialchars($_GET["From"]) . ' has just slapped ' . $ToLower . ' ' . $SlapMethod;
  54. //Example: randomslap.php?Broadcaster=TwitchBroadcaster&From=Myself&To=TwitchUsername
  55. ?>
Add Comment
Please, Sign In to add comment