Advertisement
dahnnyel1

Untitled

Apr 12th, 2020
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.13 KB | None | 0 0
  1. print("\x0314"+scriptName()+" script by binary has been loaded successfully");
  2.  
  3. String.prototype.includes = function() {'use strict'; return String.prototype.indexOf.apply(this, arguments) !== -1; };
  4.  
  5. var rec = false;//api 0f9d0e934eb38b7bbc3356c1e5714350
  6.  
  7. function rnd_color()
  8. {
  9.  
  10. var letras = "0123456789ABCDEF".split('');
  11. var color = "#";
  12.  
  13. for (var i = 0; i < 6; i++)
  14. {
  15.  
  16. color += letras[Math.floor(Math.random() * 16)];
  17.  
  18. }
  19.  
  20. return color;
  21. }
  22.  
  23.  
  24. function random(arg)
  25. {
  26. return arg[Math.floor(Math.random() * arg.length)];
  27. }
  28.  
  29. function onPersonalMessage(userobj, msg)
  30. {
  31.  
  32. if(msg.includes("\x07") && msg.includes(" - "))
  33. {
  34.  
  35. if(userobj.ticks == null)
  36. {
  37. userobj.ticks = tickCount();
  38. var last = new HttpRequest();
  39. var cancion = msg.substr(1).split(" - ");
  40. userobj.personalMessage = "\x0301\x07"+cancion[0]+"\x07 - \x07"+cancion[1];
  41. if(userobj.version.includes("cb0t"))
  42. {
  43. last.src = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=0f9d0e934eb38b7bbc3356c1e5714350&artist="+encodeURIComponent(cancion[0])+"&track="+encodeURIComponent(cancion[1])+"&format=json";
  44. //last.src = "http://ws.audioscrobbler.com/2.0/?method=album.search&album="+encodeURIComponent(cancion[0])+"&api_key=0f9d0e934eb38b7bbc3356c1e5714350&format=json";
  45. //last.src = "http://ws.audioscrobbler.com/2.0/?method=track.search&track=" + encodeURIComponent(cancion[1]) + "&artist=" + encodeURIComponent(cancion[0]) + "&api_key=ae5b5dfc532b7b172e5204516b1b5a36&format=json";
  46. }
  47. else
  48. {
  49. last.src = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=0f9d0e934eb38b7bbc3356c1e5714350&artist="+encodeURIComponent(cancion[1])+"&track="+encodeURIComponent(cancion[0])+"&format=json";
  50. //last.src = "http://ws.audioscrobbler.com/2.0/?method=album.search&album="+encodeURIComponent(cancion[1])+"&api_key=0f9d0e934eb38b7bbc3356c1e5714350&format=json";
  51. //last.src = "http://ws.audioscrobbler.com/2.0/?method=track.search&track=" + encodeURIComponent(cancion[0]) + "&artist=" + encodeURIComponent(cancion[1]) + "&api_key=ae5b5dfc532b7b172e5204516b1b5a36&format=json";
  52. }
  53. last.oncomplete = listenBack;
  54. last.download(userobj.name+"$"+cancion[0]+"$"+cancion[1]);
  55. }
  56. else
  57. {
  58. if(parseInt(tickCount()-userobj.ticks) > 20000)
  59. {
  60. userobj.ticks = tickCount();
  61. var last = new HttpRequest();
  62. var cancion = msg.substr(1).split(" - ");
  63. userobj.personalMessage = "\x0301\x07"+cancion[0]+"\x07 - \x07"+cancion[1];
  64. if(userobj.version.includes("cb0t"))
  65. {
  66. last.src = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=0f9d0e934eb38b7bbc3356c1e5714350&artist="+encodeURIComponent(cancion[0])+"&track="+encodeURIComponent(cancion[1])+"&format=json";
  67. //last.src = "http://ws.audioscrobbler.com/2.0/?method=album.search&album="+encodeURIComponent(cancion[0])+"&api_key=0f9d0e934eb38b7bbc3356c1e5714350&format=json";
  68. //last.src = "http://ws.audioscrobbler.com/2.0/?method=track.search&track=" + encodeURIComponent(cancion[1]) + "&artist=" + encodeURIComponent(cancion[0]) + "&api_key=ae5b5dfc532b7b172e5204516b1b5a36&format=json";
  69. }
  70. else
  71. {
  72. last.src = "http://ws.audioscrobbler.com/2.0/?method=track.getInfo&api_key=0f9d0e934eb38b7bbc3356c1e5714350&artist="+encodeURIComponent(cancion[1])+"&track="+encodeURIComponent(cancion[0])+"&format=json";
  73. //last.src = "http://ws.audioscrobbler.com/2.0/?method=album.search&album="+encodeURIComponent(cancion[1])+"&api_key=0f9d0e934eb38b7bbc3356c1e5714350&format=json";
  74. //last.src = "http://ws.audioscrobbler.com/2.0/?method=track.search&track=" + encodeURIComponent(cancion[0]) + "&artist=" + encodeURIComponent(cancion[1]) + "&api_key=ae5b5dfc532b7b172e5204516b1b5a36&format=json";
  75. }
  76. last.oncomplete = listenBack;
  77. last.download(userobj.name+"$"+cancion[0]+"$"+cancion[1]);
  78. }
  79. }
  80. }
  81. else
  82. {
  83. return true;
  84. }
  85. }
  86.  
  87. function listenBack()
  88. {
  89. data = this.arg.split("$");
  90. var pg = JSON.parse(this.page);
  91. if(pg.track.album.image[1]["#text"] !== null || pg.track.album.image[1]["#text"] != "")
  92. {
  93. if (pg.track.album.image[1]["#text"].length != 0)
  94. {
  95. showPic(pg, data[0], data[1], data[2]);
  96. }
  97. }
  98. }
  99.  
  100.  
  101. function showPic(json, name, song, art)
  102. {
  103.  
  104. var img_obj = new Scribble();
  105. img_obj.src = json.track.album.image[1]["#text"];
  106. img_obj.oncomplete = function()
  107. {
  108.  
  109. var scribble = this;
  110.  
  111. var rnd = rnd_color();
  112.  
  113. Users.local(function(t)
  114. {
  115. if(!t.version.includes("cb0t") && t.canHTML)
  116. {
  117.  
  118. t.sendHTML("<img src='" + json.track.album.image[2]["#text"] + "' width='110' height='110' /></img><font color='#b7b6b6' size='0'><br> <a style='color:"+rnd+";text-decoration: none;' href='https://soundcloud.com/search?q="+encodeURIComponent(art+" "+song)+"'>&#9658;</a> " + name + " escucha: <font color='"+rnd+"'>" + song + "<font color='#b7b6b6'> de <font color='"+rnd+"'> '"+art+"'</font>");
  119. }
  120. else
  121. {
  122. t.scribble(scribble);
  123. print(t, "\x0314"+name+" escucha: "+song+" - "+art);
  124. }
  125. });
  126. }
  127.  
  128. img_obj.download();
  129.  
  130. if(rec)
  131. {
  132. var simi = new HttpRequest();
  133. simi.utf = true;
  134. simi.src = "http://ws.audioscrobbler.com/2.0/?method=track.getsimilar&track=" + encodeURIComponent(song) + "&artist=" + encodeURIComponent(art) + "&api_key=ae5b5dfc532b7b172e5204516b1b5a36&format=json";
  135. simi.oncomplete = simiBack;
  136. simi.download(name+"$"+song);
  137. }
  138.  
  139. }
  140.  
  141. function simiBack()
  142. {
  143. var song = this.arg.split("$")[1];
  144. var name = this.arg.split("$")[0];
  145. var arr = [];
  146. var json = JSON.parse(this.page);
  147. for(var i = 2; i < 10; i++)
  148. {
  149. arr.push(json.similartracks.track[i].name+ " - "+json.similartracks.track[i].artist.name);
  150. }
  151. sendText(user(name), Room.botName, user(name).name+" te recomiendo escuchar: "+random(arr));
  152.  
  153. }
  154.  
  155. function onCommand(userobj, command, target, args)
  156. {
  157.  
  158. if (command.indexOf("recommends") == 0)
  159. {
  160. if(command.includes("on"))
  161. {
  162. rec = true;
  163. print("\x0314"+userobj.name+" activo recibir recomendaciones de canciones");
  164. }
  165. if(command.includes("off"))
  166. {
  167.  
  168. rec = false;
  169. print("\x0314"+userobj.name+" desactivo las recomendaciones de canciones");
  170. }
  171. }
  172. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement