JaBa/commands/General/github.js

45 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js"),
fetch = require("node-fetch");
class Github extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "github",
dirname: __dirname,
2021-12-26 19:32:57 +05:00
enabled: true,
2021-12-10 21:39:54 +05:00
guildOnly: false,
2021-12-26 19:32:57 +05:00
aliases: ["git"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 1000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-26 19:42:33 +05:00
const res = await fetch("https://api.github.com/repos/JonnyBro/jaba-v2");
2021-12-10 21:39:54 +05:00
const json = await res.json();
const embed = new Discord.MessageEmbed()
2021-12-26 19:29:37 +05:00
.setAuthor(this.client.user.tag, this.client.user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
2021-12-26 19:42:33 +05:00
.setDescription(`[${message.translate("general/github:CLICK_HERE")}](${json.html_url})`)
2021-12-26 19:49:02 +05:00
.addField("Название", json.name, true)
.addField("Звёзды", json.stargazers_count, true)
.addField("Форки", json.forks_count, true)
2021-12-10 21:39:54 +05:00
.addField(message.translate("general/github:LANGUAGE"), json.language, true)
2021-12-24 20:52:27 +05:00
.addField(message.translate("general/github:OWNER"), `[${json.owner.login}](${json.owner.html_url})`)
2021-12-10 21:39:54 +05:00
.setImage(json.owner.avatar_url)
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
message.channel.send(embed);
}
};
module.exports = Github;