Advertisement
kyroskoh

Twitch CustomAPI - Random Kill

May 7th, 2016
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.55 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 kill someone, you need to tell me who you wish to kill!';
  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 kill the broadcaster.
  25. if ($ToLower == $BroadcasterLower)
  26. {
  27.     echo htmlspecialchars($_GET["From"]) . ' has just tried to kill ' . $ToCorrectName['display_name'] . '! 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... ' . $ToCorrectName['display_name'] . ' appears to have a suicide wish.';
  34.     die();
  35. }
  36. // Tried to kill a bot, I know there's many more, add to suit yourself.
  37. elseif ($ToLower == 'nightbot' || $ToLower == 'wizebot' || $ToLower == 'moobot')
  38. {
  39.     echo 'One does not simply kill a bot!';
  40.     die();
  41. }
  42. // The kill methods array.
  43. $Methods = array
  44. (
  45.     "with a baseball bat!",
  46.     "with a rectal cactus, OUCH!",
  47.     "with a potato!",
  48.     "with a gun, bang bang!",
  49.     "with a knife, stabby stabby!",
  50.     "by putting needles in their eye!",
  51.     "by running them over with a tractor!",
  52.     "by putting them into a baler!",
  53.     "with a laptop smashed across the head!",
  54.     "by burning them alive!",
  55.     "by means of electrocution, zap zap!",
  56.     "by freezing them!",
  57.     "by burying them alive!",
  58.     "by drowning them!",
  59.     "by pulling their limbs apart!",
  60.     "by making them drink acid!",
  61.     "by chopping them into little pieces!",
  62.     "by putting a hit out on them with the Russian mob!",
  63.     "with a candle!",
  64.     "with a frying pan!",
  65.     "with a candle stick!",
  66.     "by hacking their homes power grid and causing an overload!",
  67.     "by putting them on the terrorist watch list!",
  68.     "by causing them to laugh themselves to death!",
  69.     "with a hammer!",
  70.     "with a screwdriver!",
  71.     "with poison!",
  72.     "by choking them!",
  73.     "with a banana!",
  74.     "by pushing them into a snake pit!",
  75.     "by pushing them off a cliff!",
  76.     "by pushing them into a razor filled pit!",
  77.     "by shoving razors down their throat!",
  78.     "by strapping C4 around their neck!",
  79.     "by calling in an airstrike!",
  80.     "by running them over!",
  81.     "with a drug OD!",
  82.     "with a tire iron!",
  83.     "with a hot dog!",
  84.     "by getting them bit by a rabies infected dog!",
  85.     "with a baseball!",
  86.     "by having a robot push them into a meat grinder!",
  87.     "by pushing them into a bear trap and leaving them for a bear",
  88.     "by tying them to a tree in the middle of the woods and leaving them!",
  89.     "by pushing them into an active volcano!",
  90.     "by pushing them into the middle of the ocean!",
  91.     "with their infamous death glare!",
  92.     "by smashing a PS4 controller into their eye!"
  93. );
  94. // Count the array size, and return a ranodm entry from the array.
  95. $KillMethod = $Methods[mt_rand(0, count($Methods) - 1)];
  96. // Print the output.
  97. echo htmlspecialchars($_GET["From"]) . ' has just killed ' . $ToCorrectName['display_name'] . ' ' . $KillMethod;
  98. ?>
  99.  
  100. Example: Kill.php?Broadcaster=TwitchBroadcaster&From=Myself&To=TwitchUsername
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement