Advertisement
xgerhard

XgDestinyTracker.js

Aug 1st, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.on('command', function(event) {
  2.  
  3.     var defaultConsole  = "xbox"; // Change this to xbox or ps
  4.     var command         = event.getCommand();  
  5.     var args            = event.getArgs();
  6.    
  7.     if(command.equalsIgnoreCase("destiny")) {
  8.         try {
  9.             var HttpRequest = Packages.com.gmt2001.HttpRequest;
  10.             var HashMap     = Packages.java.util.HashMap;
  11.             var h           = new HashMap(1);
  12.             var r           = HttpRequest.getData(HttpRequest.RequestType.GET, "https://2g.be/twitch/destinyv2.php?query="+ args +"&user="+ event.getSender() +"&channel="+ $.channelName +"&defaultconsole="+ defaultConsole +"&bot=quorrabot", "", h);
  13.             if (r.success) {
  14.                 $.say(r.content);
  15.             } else {
  16.                 if (r.httpCode == 0) {
  17.                    $.say("Failed to connect to the server, please contact Xgerhard on twitch or tweet at @gerhardoh, error code 0");
  18.                 } else {
  19.                    $.say("Failed to connect to the server, please contact Xgerhard on twitch or tweet at @gerhardoh, error code 1");
  20.                 }
  21.             }
  22.         } catch (e) {
  23.             $.say("Failed to connect to the server, please contact Xgerhard on twitch or tweet at @gerhardoh, error code 2");
  24.         }
  25.     }
  26. });
  27.  
  28. setTimeout(function(){
  29.     if ($.moduleEnabled('./commands/XgDestinyTracker.js')) {
  30.         $.registerChatCommand("./commands/XgDestinyTracker.js", "destiny");
  31.     }
  32. },10*1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement