Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.             gifCommand: {
  2.                 command: ['gif', 'giphy'],
  3.                 rank: 'user',
  4.                 type: 'startsWith',
  5.                 functionality: function (chat, cmd) {
  6.                     if (this.type === 'exact' && chat.message.length !== cmd.length) return void (0);
  7.                     if (!basicBot.commands.executable(this.rank, chat)) return void (0);
  8.                     else {
  9.                         var msg = chat.message;
  10.                         if (msg.length !== cmd.length) {
  11.                             function get_id(api_key, fixedtag, func)
  12.                             {
  13.                                 $.getJSON(
  14.                                     "https://tv.giphy.com/v1/gifs/random?",
  15.                                     {
  16.                                         "format": "json",
  17.                                         "api_key": api_key,
  18.                                         "rating": rating,
  19.                                         "tag": fixedtag
  20.                                     },
  21.                                     function(response)
  22.                                     {
  23.                                         func(response.data.id);
  24.                                     }
  25.                                     )
  26.                             }
  27.                             var api_key = "dc6zaTOxFJmzC"; // public beta key
  28.                             var rating = "pg-13"; // PG 13 gifs
  29.                             var tag = msg.substr(cmd.length + 1);
  30.                             var fixedtag = tag.replace(/ /g,"+");
  31.                             var commatag = tag.replace(/ /g,", ");
  32.                             get_id(api_key, tag, function(id) {
  33.                                 if (typeof id !== 'undefined') {
  34.                                     API.sendChat(subChat(basicBot.chat.validgiftags, {name: chat.un, id: id, tags: commatag}));
  35.                                 } else {
  36.                                     API.sendChat(subChat(basicBot.chat.invalidgiftags, {name: chat.un, tags: commatag}));
  37.                                 }
  38.                             });
  39.                         }
  40.                         else {
  41.                             function get_random_id(api_key, func)
  42.                             {
  43.                                 $.getJSON(
  44.                                     "https://tv.giphy.com/v1/gifs/random?",
  45.                                     {
  46.                                         "format": "json",
  47.                                         "api_key": api_key,
  48.                                         "rating": rating
  49.                                     },
  50.                                     function(response)
  51.                                     {
  52.                                         func(response.data.id);
  53.                                     }
  54.                                     )
  55.                             }
  56.                             var api_key = "dc6zaTOxFJmzC"; // public beta key
  57.                             var rating = "pg-13"; // PG 13 gifs
  58.                             get_random_id(api_key, function(id) {
  59.                                 if (typeof id !== 'undefined') {
  60.                                     API.sendChat(subChat(basicBot.chat.validgifrandom, {name: chat.un, id: id}));
  61.                                 } else {
  62.                                     API.sendChat(subChat(basicBot.chat.invalidgifrandom, {name: chat.un}));
  63.                                 }
  64.                             });
  65.                         }
  66.                     }
  67.                 }
  68.             },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement