forked from mahmudx7/HINATA
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub.js
More file actions
86 lines (72 loc) · 2.76 KB
/
Copy pathgithub.js
File metadata and controls
86 lines (72 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const axios = require("axios");
const baseApiUrl = async () => {
const base = await axios.get("https://raw.githubusercontent.com/mahmudx7/HINATA/main/baseApiUrl.json");
return base.data.mahmud;
};
/**
* @author MahMUD
* @author: do not delete it
*/
module.exports = {
config: {
name: "github",
aliases: ["git"],
version: "1.7",
author: "MahMUD",
countDown: 10,
category: "info",
guide: { en: "{pn} [username]" }
},
onStart: async function ({ api, event, args }) {
const obfuscatedAuthor = String.fromCharCode(77, 97, 104, 77, 85, 68);
if (module.exports.config.author !== obfuscatedAuthor) {
return api.sendMessage("You are not authorized to change the author name.", event.threadID, event.messageID);
}
const { threadID, messageID } = event;
const username = args[0];
if (!username) return api.sendMessage("Please Provide a Github Username.\n\nExample: {pn} Github Mahmudx7", threadID, messageID);
try {
const apiUrl = await baseApiUrl();
const res = await axios.get(`${apiUrl}/api/github?user=${encodeURIComponent(username)}`);
const d = res.data.data;
const info = `>🎀 USER GITHUB INFO
• Name: ${d.profile.name || "N/A"}
• Username: ${d.profile.username}
• ID: ${d.profile.id}
• Type: ${d.profile.type}
• Verified: ${d.profile.is_staff ? "GitHub Staff" : "No"}
• Bio: ${d.profile.bio || "N/A"}
• Most Use Language: ${d.stats.favorite_language}
👥 FOLLOWER
• Followers: ${d.stats.followers}
• Following: ${d.stats.following}
📧 USER CONTACT
• Public Email: ${d.contact.email || "Not Found"}
• Location: ${d.contact.location || "N/A"}
• Website: ${d.contact.website || "N/A"}
📦 PUBLIC REPO
• Public Repos: ${d.stats.public_repos}
• Archived: ${d.stats.archived_repos}
• Total Forks: ${d.stats.total_forks}
• Total Stars: ${d.stats.total_stars}
• Code Size: ${d.stats.code_size_mb} MB
🔗 TOP REPOSITORY
• Repo Name: ${d.highlights.top_repo ? d.highlights.top_repo.name : "N/A"}
• Repo Star: ${d.highlights.top_repo ? d.highlights.top_repo.stars : "0"}
• Repo Fork: ${d.highlights.top_repo ? d.highlights.top_repo.forks : "0"}
• Repo Link: ${d.highlights.top_repo ? d.highlights.top_repo.url : "N/A"}
📅 JOIN & UPDATE
• Joined: ${new Date(d.meta.joined_at).toDateString()}
• Account Age: ${d.meta.account_age_years} years
• Last Active Repo: ${d.highlights.last_active_repo || "N/A"}
• Last Profile Update: ${new Date(d.meta.updated_at).toDateString()}`;
return api.sendMessage({
body: info,
attachment: await global.utils.getStreamFromURL(d.profile.avatar)
}, threadID, messageID);
} catch (e) {
console.error(e);
return api.sendMessage("API error, Contact MahMUD.", threadID, messageID);
}
}
};