{"size": 5021, "ext": "js", "max_stars_repo_path": "Source/Client/Commands/UserInfo.js", "max_stars_repo_name": "honzaxdddddd/Drift", "max_stars_repo_stars_event_min_datetime": "2021-11-19T07:55:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-19T07:55:22.000Z", "max_issues_repo_path": "Source/Client/Commands/UserInfo.js", "max_issues_repo_name": "honzaxdddddd/Drift", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Source/Client/Commands/UserInfo.js", "max_forks_repo_name": "honzaxdddddd/Drift", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 44.0438596491, "max_line_length": 263, "alphanum_fraction": 0.4608643696}
module.exports = {
    name: "userinfo",
    description: "Drift fetches specified user and returns everything it could find about them.",
    category: "General",
    dmOnly: false,
    guildOnly: false,
    usage: "{prefix}{commandName} <User ID or Mention>",
    requiredPermissions: "EMBED_LINKS",
    run: (message, args) => {
        const { Client } = require("../Structures/Client.js")
        const Discord = require("discord.js")
        const moment = require("moment")

        const Config = require("../../../Data/options.json")
        const Lang = require("../../Lang/Commands.json")

        const locale = {
            "cz" : "cs",
            "en" : "en"
        }

        const bool = {
            true : Lang.yes[Config.Language || "en"],
            false : Lang.no[Config.Language || "en"]
        }

        if(!args[0]) {
            let embed = new Discord.RichEmbed()
            embed.setDescription(Lang.userinfo.errNoUser[Config.Language || "en"])
            embed.setColor(`#65429b`)
            try {
                message.channel.send(embed)
            } catch (e) {
                try {
                    message.channel.send(`> ${Lang.userinfo.errNoUser[Config.Language || "en"]}`)
                } catch (e) {
                    return
                }
            }
            return
        }
        const user = message.mentions.users.first() || message.mentions.members.first() || Client.users.get(args[0])

        if(!user) {
            let embed = new Discord.RichEmbed()
            embed.setDescription(Lang.userinfo.errInvalidUser[Config.Language || "en"])
            embed.setColor(`#65429b`)
            try {
                message.channel.send(embed)
            } catch (e) {
                try {
                    message.channel.send(`> ${Lang.userinfo.errInvalidUser[Config.Language || "en"]}`)
                } catch (e) {
                    return
                }
            }
            return
        }
        if(user) {
            if(message.guild) {
                const m = message.guild.members.get(user.id)
                let embed = new Discord.RichEmbed()
                embed.setTitle(user.tag)
                embed.addField(Lang.userinfo.titles.general[Config.language || "en"], [
                    `**${Lang.userinfo.username[Config.language || "en"]}:** ${user.username}`,
                    `**${Lang.userinfo.discriminator[Config.language || "en"]}:** ${user.discriminator}`,
                    `**ID:** ${user.id}`,
                    `**${Lang.userinfo.createdat[Config.language || "en"]}:** ${moment(user.createdTimestamp).locale(locale[Config.language || "en"]).format("LL LTS")} **[**${moment(user.createdTimestamp).locale(locale[Config.language || "en"]).fromNow()}**]**`,
                    `**${Lang.userinfo.verified[Config.language || "en"]}:** ${bool[user.system]}`
                ])
                embed.addField(Lang.userinfo.titles.guild[Config.Language || "en"], [
                    `**${Lang.userinfo.hexColor}:** ${m.displayHexColor}`
                ])
                embed.setThumbnail(user.displayAvatarURL)
                if(m.displayHexColor == "#000000") {
                    
                }
                embed.setColor(m.displayHexColor || `#65429b`)
                try {
                    message.channel.send(embed)
                } catch (e) {
                    try {
                        message.channel.send(`> Look for \`EMBED_LINKS\` permission first.`)
                    } catch (e) {
                        return
                    }
                }
                return
            } else {
                let embed = new Discord.RichEmbed()
                embed.setTitle(user.tag)
                embed.addField(Lang.userinfo.titles.general[Config.language || "en"], [
                    `**${Lang.userinfo.username[Config.language || "en"]}:** ${user.username}`,
                    `**${Lang.userinfo.discriminator[Config.language || "en"]}:** ${user.discriminator}`,
                    `**ID:** ${user.id}`,
                    `**${Lang.userinfo.createdat[Config.language || "en"]}:** ${moment(user.createdTimestamp).locale(locale[Config.language || "en"]).format("LL LTS")} **[**${moment(user.createdTimestamp).locale(locale[Config.language || "en"]).fromNow()}**]**`,
                    `**Verified:** ${bool[user.system]}`
                ])
                embed.setThumbnail(user.displayAvatarURL)
                embed.setColor(`#65429b`)
                try {
                    message.channel.send(embed)
                } catch (e) {
                    try {
                        message.channel.send(`> Look for \`EMBED_LINKS\` permission first.`)
                    } catch (e) {
                        return
                    }
                }
                return
            }
        }
    }
}