Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const bot = new Discord.Client({ disableEveryone: false });
- const fs = require('fs')
- let client = bot;
- bot.on(`ready`, () => {
- console.log(`Logged in as ${bot.user.tag}!`);
- bot.user.setStatus("online")
- });
- client.on('error', console.error);
- bot.on("message", async message => {
- let prefix = `$` //يمديك تغيره لو تبي
- let messageArray = message.content.split(" ");
- let msg = message;
- let cmd = messageArray[0];
- let args = messageArray.slice(1);
- if (!message.content.startsWith(prefix)) return;
- if (message.content.startsWith(prefix + "hypixel")) {
- const Hypixel = require('hypixel');
- const Client = new Hypixel({ key: 'ادخل هايبكسل سوي /api' });
- const moment = require("moment");
- Client.getPlayerByUsername(args, (err, player) => {
- // console.log(player)
- if (player === undefined || player === null) return message.channel.send("Player not found buddy")
- let rank = player.newPackageRank
- let mcver = player.mcVersionRp
- let lastLogout = player.lastLogout
- let firstLogin = player.firstLogin
- let karma = player.karma
- if (mcver === undefined) {
- mcver = `\`Non\``
- }
- message.channel.startTyping(true)
- if (!rank) rank = 'Non'
- let exp = player.networkExp
- var x = (Math.sqrt(exp + 15312.5) - 125 / Math.sqrt(2)) / (25 * Math.sqrt(2))
- x = x.toFixed(2)
- let hypixel = new Discord.RichEmbed()
- if (rank === 'MVP_PLUS' && player.monthlyPackageRank !== 'SUPERSTAR') {
- rank = 'MVP+'
- hypixel.setThumbnail('https://i.imgur.com/wvXzJMA.png')
- }
- if (player.mostRecentMonthlyPackageRank === 'SUPERSTAR' && player.monthlyPackageRank === 'SUPERSTAR') {
- rank = 'MVP++'
- hypixel.setThumbnail('https://i.imgur.com/w3l6hGY.png')
- }
- if (player.rank === 'HELPER') hypixel.setThumbnail('https://i.imgur.com/xTOmY9L.png')
- if (player.rank === 'MODERATOR') hypixel.setThumbnail('https://i.imgur.com/HQEZazI.png')
- if (player.rank === 'ADMIN') hypixel.setThumbnail('https://i.imgur.com/wIisMcZ.png')
- if (player.rank !== 'ADMIN' && player.monthlyPackageRank !== 'SUPERSTAR' && player.rank !== 'MODERATOR' && player.newPackageRank !== 'MVP_PLUS' && player.rank !== 'HELPER') {
- hypixel.setThumbnail('https://i.imgur.com/7aFEXPY.png')
- }
- Client.findGuildByPlayer(player.uuid)
- .then((guildId) => {
- let hi = `https://api.hypixel.net/guild?key=الأي بي اي &id=${guildId}`
- let image = `${`https://visage.surgeplay.com/full/250/${player.uuid}.png`}`
- const fetch = require('node-fetch')
- fetch(`${hi}`)
- .then(res => res.json()
- .then(json => {
- hypixel.setTitle(`[${rank}]` + ` ${args}`)
- hypixel.setURL(`https://hypixel.net/player/${args}`)
- hypixel.addField('Rank', `\`${rank}\``, true)
- hypixel.addField('Level', `\`${x}\``, true)
- hypixel.addField('Minecraft Version', `\`${mcver}\``, true)
- if (json.guild === undefined || !json.guild) {
- hypixel.addField('Guild', '\`Non\`', true)
- } else if (json.guild.name !== undefined) {
- hypixel.addField('Guild', `[${json.guild.name}](https://hypixel.net/guilds/${json.guild.name.replace(" ", "%20")})`, true)
- }
- hypixel.addField('Karma', `\`${karma.toLocaleString('en')}\``, true)
- hypixel.addField('First/Last login', `\`${moment(firstLogin).format("YYYY-MM-DD")} / ${moment(lastLogout).format("YYYY-MM-DD")}\`\n\`${moment(player.lastLogout).fromNow()}\``, true)
- hypixel.setImage(image);
- if (player.socialMedia !== undefined) {
- let that = message.guild.members.find(c => c.displayName === `${player.socialMedia.links["DISCORD"].slice(0, -5)}`);
- if (that !== null) {
- that = message.guild.members.find(c => c.displayName === `${player.socialMedia.links["DISCORD"].slice(0, -5)}`)
- } else if (that === null) {
- that = `${player.socialMedia.links["DISCORD"]}`
- }
- hypixel.addField("Discord", `${that}`, true)
- hypixel.addField('Forums', `[View Forums account.](https://hypixel.net/player/${args})`, true)
- }
- message.channel.stopTyping(true)
- message.channel.send(hypixel)
- }).catch((err) => {
- message.channel.stopTyping(true)
- if (err) throw err;
- return message.channel.send('Uh oh ... there must be a problem!')
- }));
- }).catch((err) => {
- message.channel.stopTyping(true)
- if (err) throw err;
- return message.channel.send('Uh oh ... there must be a problem!')
- });
- })
- }
- });
- client.login("login")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement