Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.89 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const bot = new Discord.Client({ disableEveryone: false });
  3. let client = bot;
  4. const ms = require("ms");
  5. const fs = require("fs");
  6. var request = require("request");
  7. const Jimp = require('jimp');
  8. const diff = require('color-diff');
  9. const getJSON = require('get-json');
  10. const download = require('image-downloader');
  11. var cheerio = require("cheerio");
  12. const talkedRecently = new Set();
  13. client.on("ready", function() {
  14. client.user.setActivity("MohamedTarek");
  15. console.log('شغال')
  16. });
  17.  
  18. client.on("message", message => {
  19. let msg = message;
  20. let prefix = `!!`
  21. let messageArray = message.content.split(" ");
  22. let cmd = messageArray[0].toLowerCase();
  23. let args = messageArray.slice(1);
  24.  
  25. if (!message.content.startsWith(prefix)) return;
  26. if(cmd === `${prefix}blocks`){
  27. if (message.author.id === bot.user.id) return;
  28. let [player, lol, ...rest] = args;
  29. let page = parseInt(lol, 10);
  30. if(!player) return message.reply(`**Usage: \`${prefix}blocks <Player Name> [page]\`**`);
  31. request(`https://blocksmc.com/player/${player}`, (err,res,html)=>{
  32. if(err || res.statusCode != 200) return message.channel.send('There seems to be an error with the API. Try again later. :confounded:');
  33. if (!err && res.statusCode == 200){
  34. const $ = cheerio.load(html);
  35. const userName = $('.profile-header').find('h1').text();
  36. if (!userName) return message.channel.send("Player not found")
  37. const userTime = $('.gray-cont').find('h1').text().trim();
  38. const userRankData = $('.profile-rank');
  39. const userRank = userRankData.text().trim();
  40. let userHexColor;
  41. if(userRank === "Member") userHexColor = "#2b76aa";
  42. else if(userRank === "Owner") userHexColor = "#fff000";
  43. else if(userRank === "VIP Member") userHexColor = "#ba50e7";
  44. else if(userRank === "Moderator") userHexColor = "#e76250";
  45. else if(userRank === "Senior Moderator") userHexColor = "#841818";
  46. else if(userRank === "Admin") userHexColor = "#841818";
  47. else if(userRank === "Head Admin") userHexColor = "#841818";
  48. else if(userRank === "Emerald Member") userHexColor = "#00a86b";
  49. else if(userRank === "Diamond Member") userHexColor = "#01c5b8";
  50. else if(userRank === "Gold Member") userHexColor = "#f3bc00";
  51. else if(userRank === "Dev") userHexColor = "#202020";
  52. else userHexColor = "#2b76aa";
  53. let getData = function(key, value){
  54. let text = $(`#${key} #${value}.val`).text();
  55. return parseInt(text,10);
  56. }
  57. const stats = {
  58. //BlocksParty
  59. BP: {
  60. points: getData(`BP`, `Points`),
  61. wins: getData(`BP`, `Wins`),
  62. played: getData(`BP`, `Played`),
  63. image: "https://blocksmc.com/images/pfavatars/BlockParty.png"
  64. },
  65. //Splegg
  66. SP: {
  67. points: getData(`SP`, `Points`),
  68. eggs: getData(`SP`, `Eggs`),
  69. blocks: getData(`SP`, `Blocks`),
  70. wins: getData(`SP`, `Wins`),
  71. played: getData(`SP`, `Played`),
  72. image: "https://blocksmc.com/images/pfavatars/Splegg.png"
  73. },
  74. //QuakeCraft
  75. QC: {
  76. points: getData(`QC`, `Points`),
  77. kills: getData(`QC`, `Kills`),
  78. deaths: getData(`QC`, `Deaths`),
  79. fireworks: getData(`QC`, `FireWorks`),
  80. wins: getData(`QC`, `Wins`),
  81. played: getData(`QC`, `Played`),
  82. image: "https://blocksmc.com/images/pfavatars/QuakeCraft.png"
  83. },
  84. //Gravity
  85. GR: {
  86. points: getData(`GR`, `Points`),
  87. wins: getData(`GR`, `Wins`),
  88. played: getData(`GR`, `Played`),
  89. image: "https://blocksmc.com/images/pfavatars/Gravity.png"
  90. },
  91. //SurvivalGames
  92. SG: {
  93. points: getData(`SG`, `Points`),
  94. kills: getData(`SG`, `Kills`),
  95. deaths: getData(`SG`, `Deaths`),
  96. wins: getData(`SG`, `Wins`),
  97. crates: getData(`SG`, `Crates`),
  98. played: getData(`SG`, `Played`),
  99. image: "https://blocksmc.com/images/pfavatars/SurvivalGames.png"
  100. },
  101. //LuckyBlockWars
  102. LBW: {
  103. points: getData(`LBW`, `Points`),
  104. kills: getData(`LBW`, `Kills`),
  105. deaths: getData(`LBW`, `Deaths`),
  106. wins: getData(`LBW`, `Wins`),
  107. sponges: getData(`LBW`, `Sponges`),
  108. played: getData(`LBW`, `Played`),
  109. image: "https://blocksmc.com/images/pfavatars/LuckyBlockWars.png"
  110. },
  111. //EggWars
  112. EW: {
  113. points: getData(`EW`, `Points`),
  114. kills: getData(`EW`, `Kills`),
  115. deaths: getData(`EW`, `Deaths`),
  116. wins: getData(`EW`, `Wins`),
  117. eggs: getData(`EW`, `Eggs`),
  118. played: getData(`EW`, `Played`),
  119. image: "https://blocksmc.com/images/pfavatars/EggWars.png"
  120. },
  121. //EggWars:Solo
  122. EWS: {
  123. points: getData(`EWS`, `Points`),
  124. kills: getData(`EWS`, `Kills`),
  125. deaths: getData(`EWS`, `Deaths`),
  126. wins: getData(`EWS`, `Wins`),
  127. eggs: getData(`EWS`, `Eggs`),
  128. played: getData(`EWS`, `Played`),
  129. image: "https://blocksmc.com/images/pfavatars/EggWarsSolo.png"
  130. },
  131. //BedWars
  132. BW: {
  133. points: getData(`BW`, `Points`),
  134. kills: getData(`BW`, `Kills`),
  135. deaths: getData(`BW`, `Deaths`),
  136. wins: getData(`BW`, `Wins`),
  137. beds: getData(`BW`, `Beds`),
  138. played: getData(`BW`, `Played`),
  139. image: "https://blocksmc.com/images/pfavatars/BedWars.png"
  140. },
  141. //BedWars:Solo
  142. BWS: {
  143. points: getData(`BWS`, `Points`),
  144. kills: getData(`BWS`, `Kills`),
  145. deaths: getData(`BWS`, `Deaths`),
  146. wins: getData(`BWS`, `Wins`),
  147. beds: getData(`BWS`, `Beds`),
  148. played: getData(`BWS`, `Played`),
  149. image: "https://blocksmc.com/images/pfavatars/BedWarsSolo.png"
  150. },
  151. //SkyWars
  152. SW: {
  153. points: getData(`SW`, `Points`),
  154. kills: getData(`SW`, `Kills`),
  155. deaths: getData(`SW`, `Deaths`),
  156. wins: getData(`SW`, `Wins`),
  157. played: getData(`SW`, `Played`),
  158. image: "https://blocksmc.com/images/pfavatars/SkyWars.png"
  159. },
  160. //SkyWars:Solo
  161. SWS: {
  162. points: getData(`SWS`, `Points`),
  163. kills: getData(`SWS`, `Kills`),
  164. deaths: getData(`SWS`, `Deaths`),
  165. wins: getData(`SWS`, `Wins`),
  166. played: getData(`SWS`, `Played`),
  167. image: "https://blocksmc.com/images/pfavatars/SkyWarsSolo.png"
  168. },
  169. //SkyGiant
  170. GNT: {
  171. points: getData(`GNT`, `Points`),
  172. kills: getData(`GNT`, `Kills`),
  173. deaths: getData(`GNT`, `Deaths`),
  174. wins: getData(`GNT`, `Wins`),
  175. played: getData(`GNT`, `Played`),
  176. image: "https://blocksmc.com/images/pfavatars/SkyGiant.png"
  177. },
  178. //SkyGiant Mini
  179. GNTM: {
  180. points: getData(`GNTM`, `Points`),
  181. kills: getData(`GNTM`, `Kills`),
  182. deaths: getData(`GNTM`, `Deaths`),
  183. wins: getData(`GNTM`, `Wins`),
  184. played: getData(`GNTM`, `Played`),
  185. image: "https://blocksmc.com/images/pfavatars/SkyGiantMini.png"
  186. },
  187. //The Bridge
  188. TB: {
  189. points: getData(`TB`, `Points`),
  190. kills: getData(`TB`, `Kills`),
  191. deaths: getData(`TB`, `Deaths`),
  192. wins: getData(`TB`, `Wins`),
  193. goals: getData(`TB`, `Goals`),
  194. played: getData(`TB`, `Played`),
  195. image: "https://blocksmc.com/images/pfavatars/TheBridge.png"
  196. },
  197. //1VS1
  198. oneVSone: {
  199. points: getData(`1VS1`, `Points`),
  200. kills: getData(`1VS1`, `Kills`),
  201. deaths: getData(`1VS1`, `Deaths`),
  202. wins: getData(`1VS1`, `Wins`),
  203. rounds: getData(`1VS1`, `Rounds`),
  204. played: getData(`1VS1`, `Played`),
  205. image: "https://blocksmc.com/images/pfavatars/1VS1.png"
  206. },
  207. };
  208. request.get(`https://api.mojang.com/users/profiles/minecraft/${userName}`, (err, res, body)=>{
  209.  
  210. if(!err && res.statusCode === 200){
  211. message.channel.startTyping()
  212. body = JSON.parse(body);
  213. let image = `https://visage.surgeplay.com/full/250/${body.id}.png`;
  214. for (const key in stats) {
  215. if(`${stats[key].points}` === "NaN"){
  216. delete stats[key];
  217. };
  218. };
  219. const embed = new Discord.RichEmbed()
  220. .setAuthor(userName, `https://minotar.net/helm/${userName}`, `https://blocksmc.com/player/${userName}`)
  221. .addField("**Rank**", `\`${userRank}\``, true)
  222. .addField("**Hours**", `\`${userTime}\``, true)
  223. .setColor(userHexColor)
  224. .setImage(image)
  225. .setThumbnail("https://cdn.discordapp.com/icons/211543198651121664/a4baa5a87ff496ef33430c795d5186ff.png")
  226. let pages = [embed];
  227. if(stats.hasOwnProperty("BP")){
  228. const BPEmbed = new Discord.RichEmbed()
  229. .addField("**Played:**", `\`${stats.BP.played}\``, true)
  230. .addField("**Points:**", `\`${stats.BP.points}\``, true)
  231. .addField("**Wins:**", `\`${stats.BP.wins}\``, true)
  232. .setImage(stats.BP.image)
  233. pages.push(BPEmbed);
  234. }
  235. if(stats.hasOwnProperty("SP")){
  236. const SPEmbed = new Discord.RichEmbed()
  237. .addField("**Points:**", `\`${stats.SP.points}\``, true)
  238. .addField("**Wins:**", `\`${stats.SP.wins}\``, true)
  239. .addField("**Played:**", `\`${stats.SP.played}\``, true)
  240. .addField("**Eggs:**", `\`${stats.SP.eggs}\``, true)
  241. .addField("**Blocks:**", `\`${stats.SP.blocks}\``, true)
  242. .addBlankField(true)
  243. .setImage(stats.SP.image)
  244. pages.push(SPEmbed);
  245. }
  246. if(stats.hasOwnProperty("QC")){
  247. const QCEmbed = new Discord.RichEmbed()
  248. .addField("**Points:**", `\`${stats.QC.points}\``, true)
  249. .addField("**Played:**", `\`${stats.QC.played}\``, true)
  250. .addField("**Deaths:**", `\`${stats.QC.deaths}\``, true)
  251. .addField("**Fireworks:**", `\`${stats.QC.fireworks}\``, true)
  252. .addField("**Kills:**", `\`${stats.QC.kills}\``, true)
  253. .addField("**Wins:**", `\`${stats.QC.wins}\``, true)
  254. .setImage(stats.QC.image)
  255. pages.push(QCEmbed);
  256. }
  257. if(stats.hasOwnProperty("GR")){
  258. const GREmbed = new Discord.RichEmbed()
  259. .addField("**Points:**", `\`${stats.GR.points}\``, true)
  260. .addField("**Played:**", `\`${stats.GR.played}\``, true)
  261. .addField("**Wins:**", `\`${stats.GR.wins}\``, true)
  262. .setImage(stats.GR.image)
  263. pages.push(GREmbed);
  264. }
  265. if(stats.hasOwnProperty("SG")){
  266. const SGEmbed = new Discord.RichEmbed()
  267. .addField("**Points:**", `\`${stats.SG.points}\``, true)
  268. .addField("**Played:**", `\`${stats.SG.played}\``, true)
  269. .addField("**Deaths:**", `\`${stats.SG.deaths}\``, true)
  270. .addField("**Crates:**", `\`${stats.SG.crates}\``, true)
  271. .addField("**Kills:**", `\`${stats.SG.kills}\``, true)
  272. .addField("**Wins:**", `\`${stats.SG.wins}\``, true)
  273. .setImage(stats.SG.image)
  274. pages.push(SGEmbed);
  275. }
  276. if(stats.hasOwnProperty("LBW")){
  277. const LBWEmbed = new Discord.RichEmbed()
  278. .addField("**Points:**", `\`${stats.LBW.points}\``, true)
  279. .addField("**Played:**", `\`${stats.LBW.played}\``, true)
  280. .addField("**Deaths:**", `\`${stats.LBW.deaths}\``, true)
  281. .addField("**Sponges:**", `\`${stats.LBW.sponges}\``, true)
  282. .addField("**Kills:**", `\`${stats.LBW.kills}\``, true)
  283. .addField("**Wins:**", `\`${stats.LBW.wins}\``, true)
  284. .setImage(stats.LBW.image)
  285. pages.push(LBWEmbed);
  286. }
  287. if(stats.hasOwnProperty("EW")){
  288. const EWEmbed = new Discord.RichEmbed()
  289. .addField("**Points:**", `\`${stats.EW.points}\``, true)
  290. .addField("**Played:**", `\`${stats.EW.played}\``, true)
  291. .addField("**Deaths:**", `\`${stats.EW.deaths}\``, true)
  292. .addField("**Eggs:**", `\`${stats.EW.eggs}\``, true)
  293. .addField("**Kills:**", `\`${stats.EW.kills}\``, true)
  294. .addField("**Wins:**", `\`${stats.EW.wins}\``, true)
  295. .setImage(stats.EW.image)
  296. pages.push(EWEmbed);
  297. }
  298. if(stats.hasOwnProperty("EWS")){
  299. const EWSEmbed = new Discord.RichEmbed()
  300. .addField("**Points:**", `\`${stats.EWS.points}\``, true)
  301. .addField("**Played:**", `\`${stats.EWS.played}\``, true)
  302. .addField("**Deaths:**", `\`${stats.EWS.deaths}\``, true)
  303. .addField("**Eggs:**", `\`${stats.EWS.eggs}\``, true)
  304. .addField("**Kills:**", `\`${stats.EWS.kills}\``, true)
  305. .addField("**Wins:**", `\`${stats.EWS.wins}\``, true)
  306. .setImage(stats.EWS.image)
  307. pages.push(EWSEmbed);
  308. }
  309. if(stats.hasOwnProperty("BW")){
  310. const BWEmbed = new Discord.RichEmbed()
  311. .addField("**Points:**", `\`${stats.BW.points}\``, true)
  312. .addField("**Played:**", `\`${stats.BW.played}\``, true)
  313. .addField("**Deaths:**", `\`${stats.BW.deaths}\``, true)
  314. .addField("**Beds:**", `\`${stats.BW.beds}\``, true)
  315. .addField("**Kills:**", `\`${stats.BW.kills}\``, true)
  316. .addField("**Wins:**", `\`${stats.BW.wins}\``, true)
  317. .setImage(stats.BW.image)
  318. pages.push(BWEmbed);
  319. }
  320. if(stats.hasOwnProperty("BWS")){
  321. const BWSEmbed = new Discord.RichEmbed()
  322. .addField("**Points:**", `\`${stats.BWS.points}\``, true)
  323. .addField("**Played:**", `\`${stats.BWS.played}\``, true)
  324. .addField("**Deaths:**", `\`${stats.BWS.deaths}\``, true)
  325. .addField("**Beds:**", `\`${stats.BWS.beds}\``, true)
  326. .addField("**Kills:**", `\`${stats.BWS.kills}\``, true)
  327. .addField("**Wins:**", `\`${stats.BWS.wins}\``, true)
  328. .setImage(stats.BWS.image)
  329. pages.push(BWSEmbed);
  330. }
  331. if(stats.hasOwnProperty("SW")){
  332. const SWEmbed = new Discord.RichEmbed()
  333. .addField("**Points:**", `\`${stats.SW.points}\``, true)
  334. .addField("**Played:**", `\`${stats.SW.played}\``, true)
  335. .addField("**Deaths:**", `\`${stats.SW.deaths}\``, true)
  336. .addField("**Kills:**", `\`${stats.SW.kills}\``, true)
  337. .addField("**Wins:**", `\`${stats.SW.wins}\``, true)
  338. .addBlankField(true)
  339. .setImage(stats.SW.image)
  340. pages.push(SWEmbed);
  341. }
  342. if(stats.hasOwnProperty("SWS")){
  343. const SWSEmbed = new Discord.RichEmbed()
  344. .addField("**Points:**", `\`${stats.SWS.points}\``, true)
  345. .addField("**Played:**", `\`${stats.SWS.played}\``, true)
  346. .addField("**Deaths:**", `\`${stats.SWS.deaths}\``, true)
  347. .addField("**Kills:**", `\`${stats.SWS.kills}\``, true)
  348. .addField("**Wins:**", `\`${stats.SWS.wins}\``, true)
  349. .addBlankField(true)
  350. .setImage(stats.SWS.image)
  351. pages.push(SWSEmbed);
  352. }
  353. if(stats.hasOwnProperty("GNT")){
  354. const GNTEmbed = new Discord.RichEmbed()
  355. .addField("**Points:**", `\`${stats.GNT.points}\``, true)
  356. .addField("**Played:**", `\`${stats.GNT.played}\``, true)
  357. .addField("**Deaths:**", `\`${stats.GNT.deaths}\``, true)
  358. .addField("**Kills:**", `\`${stats.GNT.kills}\``, true)
  359. .addField("**Wins:**", `\`${stats.GNT.wins}\``, true)
  360. .addBlankField(true)
  361. .setImage(stats.GNT.image)
  362. pages.push(GNTEmbed);
  363. }
  364. if(stats.hasOwnProperty("GNTM")){
  365. const GNTMEmbed = new Discord.RichEmbed()
  366. .addField("**Points:**", `\`${stats.GNTM.points}\``, true)
  367. .addField("**Played:**", `\`${stats.GNTM.played}\``, true)
  368. .addField("**Deaths:**", `\`${stats.GNTM.deaths}\``, true)
  369. .addField("**Kills:**", `\`${stats.GNTM.kills}\``, true)
  370. .addField("**Wins:**", `\`${stats.GNTM.wins}\``, true)
  371. .addBlankField(true)
  372. .setImage(stats.GNTM.image)
  373. pages.push(GNTMEmbed);
  374. }
  375. if(stats.hasOwnProperty("TB")){
  376. const TBEmbed = new Discord.RichEmbed()
  377. .addField("**Points:**", `\`${stats.TB.points}\``, true)
  378. .addField("**Played:**", `\`${stats.TB.played}\``, true)
  379. .addField("**Deaths:**", `\`${stats.TB.deaths}\``, true)
  380. .addField("**Goals:**", `\`${stats.TB.goals}\``, true)
  381. .addField("**Kills:**", `\`${stats.TB.kills}\``, true)
  382. .addField("**Wins:**", `\`${stats.TB.wins}\``, true)
  383. .setImage(stats.TB.image)
  384. pages.push(TBEmbed);
  385. }
  386. if(stats.hasOwnProperty("oneVSone")){
  387. const oneVSoneEmbed = new Discord.RichEmbed()
  388. .addField("**Points:**", `\`${stats.oneVSone.points}\``, true)
  389. .addField("**Played:**", `\`${stats.oneVSone.played}\``, true)
  390. .addField("**Deaths:**", `\`${stats.oneVSone.deaths}\``, true)
  391. .addField("**Rounds:**", `\`${stats.oneVSone.rounds}\``, true)
  392. .addField("**Kills:**", `\`${stats.oneVSone.kills}\``, true)
  393. .addField("**Wins:**", `\`${stats.oneVSone.wins}\``, true)
  394. .setImage(stats.oneVSone.image)
  395. pages.push(oneVSoneEmbed);
  396. }
  397. pages.forEach((e, i)=>{
  398. e.fields.forEach((f, fi)=>{
  399. if(e.fields.length === fi+1){
  400. if(f.value === "\`NaN\`"){
  401. pages.splice(i,1);
  402. };
  403. };
  404. });
  405. });
  406.  
  407. setTimeout(()=>{
  408. if(pages.length !== 1){
  409. pages.forEach(e=>{
  410. e.setColor(userHexColor);
  411. e.setFooter(`Page ${page+1} of ${pages.length} | Made by: .MohamedTarek#9258`);
  412. if(e.author === embed.author) return;
  413. e.setTitle(`${userName}'s Games Stats 📊 `);
  414. });
  415. }
  416.  
  417. var hhh = 0;
  418. var hoho = 0;
  419. if (isNaN(page)) {
  420. hhh = 1
  421. hoho = 0} else if (page > pages.length || page < 0 ) {return message.channel.send('There\'s no such page!')} else {hhh = page
  422. hoho = page-1}
  423. console.log(hhh)
  424. pages[hoho].setFooter(`Page ${hhh} of ${pages.length} looool| Made by: .MohamedTarek#9258`);
  425. if (talkedRecently.has(msg.author.id)) {
  426. return msg.channel.send("Wait 5 sec before getting typing this again.");
  427. } else {
  428. talkedRecently.add(msg.author.id);
  429. setTimeout(() => {
  430. talkedRecently.delete(msg.author.id);
  431. }, 5000);
  432. }
  433. message.channel.send(pages[hoho]).then(embedmsg=>{
  434. message.channel.stopTyping(true);
  435. if(pages.length === 1) return;
  436. embedmsg.react("◀").then(()=>{
  437. embedmsg.react("▶").then(()=>{
  438. const backwardsFilter = (reaction, user) => reaction.emoji.name === '◀' && user.id === message.author.id;
  439. const forwardsFilter = (reaction, user) => reaction.emoji.name === '▶' && user.id === message.author.id;
  440. const backwards = embedmsg.createReactionCollector(backwardsFilter, {time: 120000});
  441. const forwards = embedmsg.createReactionCollector(forwardsFilter, {time: 120000});
  442. backwards.on("collect", r=>{
  443. r.remove(message.author);
  444. if(hoho === 0) return;
  445. hhh--;
  446. hoho--;
  447. pages[hoho].setFooter(`Page ${hhh} of ${pages.length} | Made by: .MohamedTarek#9258`);
  448. embedmsg.edit(pages[hoho]);
  449. });
  450. forwards.on("collect", r=>{
  451. r.remove(message.author);
  452. if(hoho+1 === pages.length) return;
  453. hhh++;
  454. hoho++;
  455. pages[hoho].setFooter(`Page ${hhh} of ${pages.length} | Made by: .MohamedTarek#9258`);
  456. embedmsg.edit(pages[hoho]);
  457. });
  458. });
  459. });
  460. });
  461. }, 250);
  462. };
  463. });
  464. }else{
  465. return message.channel.send("There might be an error with the API or the name is incorrect")
  466. }
  467. });
  468. };
  469. if(cmd === `${prefix}history`){
  470. let player = args.slice(0).join(" ");
  471. if (!player) return message.channel.send(`**Usage: \`${prefix}history <Player Name>\`**`);
  472.  
  473. getJSON(`https://api.mojang.com/users/profiles/minecraft/${player}`, function(error, response){
  474. if (error) {
  475. return message.channel.send('There seems to be an error with the API. Try again later. :confounded:');
  476. } else {
  477. var uuid = response.id;
  478.  
  479. getJSON(`https://api.mojang.com/user/profiles/${uuid}/names`, function(error, response){
  480. var x = 1;
  481. var new_arr = response.reverse();
  482. const embed = new Discord.RichEmbed()
  483. .addField(`${player} past names`, new_arr.map(m => `${x++} \`${m['name']}\``), true);
  484. message.channel.send(embed);
  485. });
  486. }
  487. });
  488. }
  489. if(cmd === `${prefix}about`){
  490. let node = client.guilds.get("565898198279913473").emojis.get("611436703869304844");
  491. let invite = `https://discordapp.com/oauth2/authorize?&client_id=${client.user.id}&scope=bot&permissions=12659727`;
  492. let delta = client.uptime;
  493. var days = Math.floor(delta / 86400);
  494. delta -= days * 86400;
  495. var hours = Math.floor(delta / 3600) % 24;
  496. delta -= hours * 3600;
  497. var minutes = Math.floor(delta / 60) % 60;
  498. delta -= minutes * 60;
  499. var total = `${days}:${hours}:${minutes}`;
  500. let ping = Date.now() - msg.createdTimestamp;
  501. const embed = new Discord.RichEmbed()
  502. .setTitle(`:bar_chart: BlocksMC Players Bot`)
  503. .setDescription(`**[Support Team](https://discord.gg/p7krJgj)** | **[Invite](${invite})**\n\n${node.toString()} Node.js version: **${Number(process.version.match(/^v(\d+\.\d+)/)[1])}**\n:clock1230: Uptime: **${total}**\n:stopwatch: Average Ping: **${ping} ms**\n:file_cabinet: Total Servers: **${client.guilds.size}**\n:busts_in_silhouette: Total Users: **${client.users.size}**`)
  504. .setFooter(`Requested by ${msg.author.username}#${msg.author.discriminator}`, msg.author.avatarURL)
  505. .setTimestamp();
  506. msg.channel.send(embed);
  507. }
  508. if(cmd === `${prefix}invite`){
  509. let invite = `https://discordapp.com/oauth2/authorize?&client_id=${client.user.id}&scope=bot&permissions=12659727`;
  510. msg.author.send(invite);
  511. msg.reply("تم ارسال رابط دعوة البوت الى خاصك");
  512. }
  513. if(cmd === `${prefix}help`){
  514. let replies = [
  515. "**b$blocks** **-**في هذا الأمر يمكنك من رؤية معلومات واحصائيات اي لاعب في بلوكس",
  516. "**b$skin** **-** في هذا الأمر يمكنك من رؤية سكن اي لاعب تكتبه ",
  517. "**b$history** **-** في هذا الأمر يمكنك رؤية تاريخ الاسماء لأي لاعب تكتبه",
  518. "**b$suggest** **-** في هذا الأمر يمكنك ارسال اقتراح لمبرمجين البوت",
  519. "**b$invite** **-** في هذا الأمر يمكنك الحصول على رابط دعوة البوت",
  520. "**b$about** **-** في هذا الأمر يمكنك رؤية معلومات واحصائيات عن البوت "
  521. ]
  522. let replies2 =
  523. [
  524. "**b$blocks** **-** You can see Info and stats about any player in blocksmc",
  525. "**b$skin** **-** You can see the skin of any player you type",
  526. "**b$history** **-** You can see the name history of anybody you want",
  527. "**b$suggest** **-** You can send your suggestions using this command",
  528. "**b$invite** **-** You can get the bot invite using this command",
  529. "**b$about** **-** You can learn about the bot and it's stats using this command"
  530.  
  531.  
  532. ]
  533. var Embed = new Discord.RichEmbed()
  534. .setTitle("BlocksMC Community")
  535. .setAuthor("BlocksMC", `https://cdn.discordapp.com/emojis/444254912491290624.png?v=1%22`)
  536. .addField("__**الأوامر**__", replies)
  537. .addField("__**Commands**__", replies2)
  538. .setURL(`https://blocksmc.com/`)
  539. .setThumbnail("https://cdn.discordapp.com/emojis/444254912491290624.png?v=1%22")
  540. .setFooter("Developed By: .MohamedTarek#9258")
  541. message.channel.send(Embed)
  542. }
  543.  
  544.  
  545.  
  546. if(cmd === `${prefix}suggest`) {
  547. let suggestionchat = bot.guilds.get("565898198279913473").channels.get("595793620276346880")
  548. let suggestion = args.join(' ');
  549.  
  550. if(!suggestion) return message.channel.send('الرجاء وضع اقتراحك بعد الأمر');
  551. if(!suggestionchat) return message.channel.send('There seems to be an error Please Contact the developers of the bot');
  552.  
  553. let suggestionembed = new Discord.RichEmbed()
  554. .setAuthor('New Suggestion!', 'https://cdn.discordapp.com/emojis/444254912491290624.png?v=1%22)')
  555. .addField('Suggestion By', `${message.author.tag} **|** ${message.author.id}`, true)
  556. .addField('Server name', `${message.guild.name} **|** ${message.guild.id}`)
  557. .addField('Suggestion', `${suggestion}`)
  558. .setColor('#ffffff')
  559. .setTimestamp();
  560. suggestionchat.send(suggestionembed);
  561.  
  562. message.channel.send("Done =) Your suggestion has been sent to the developers")
  563. }
  564.  
  565. if(cmd === `${prefix}skin`){
  566. if (message.author.id === bot.user.id) return;
  567.  
  568. let player = args.slice(0).join(" ");
  569. if (!player) return message.channel.send('الرجاء وضع اسم اللاعب')
  570.  
  571.  
  572. getJSON(`https://api.mojang.com/users/profiles/minecraft/${player}`, function(error, response){
  573. if (error) {
  574. return message.channel.send('There seems to be an error with the API. Try again later. :confounded:');
  575. } else {
  576. var uuid = response.id;
  577.  
  578. const options = {
  579. url: `https://visage.surgeplay.com/full/250/${uuid}.png`,
  580. dest: `./${uuid}.png`
  581. };
  582. download.image(options)
  583. .then(({ filename, image }) => {
  584. console.log('File saved to', filename);
  585. })
  586. .catch((err) => {
  587. console.error(err);
  588. });
  589.  
  590. setTimeout(() => {
  591. var embed = new Discord.RichEmbed()
  592. .setTitle(player)
  593. .setColor("#ffffff")
  594. .setFooter("Made by: .MohamedTarek#9258")
  595. .attachFiles([`${__dirname}/${uuid}.png`])
  596. .setImage(`attachment://${uuid}.png`)
  597. .setThumbnail(`https://visage.surgeplay.com/head/${uuid}?size=30`)
  598. .setURL(`https://namemc.com/profile/${player}`)
  599. .addBlankField(true);
  600. message.channel.send(embed);
  601. }, 2000);
  602. }
  603. setTimeout(() => {
  604. fs.unlink(`./${uuid}.png`, function(error) {
  605. if (error) {
  606. console.log(error);
  607. }
  608. });
  609. }, 5000);
  610. });
  611. }else{
  612. return;
  613. }
  614.  
  615. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement