Последняя активность 1692056308

Command for checking a user's cordx profile!

TheRealToxicDev's Avatar TheRealToxicDev ревизий этого фрагмента 1692056308. К ревизии

1 file changed, 95 insertions

profile.js(файл создан)

@@ -0,0 +1,95 @@
1 + module.exports = {
2 + name: 'profile',
3 + category: 'Sharex',
4 + description: 'View your cordx profile/information',
5 + userPerms: [''],
6 + basePerms: [''],
7 + options: [
8 + {
9 + name: 'user',
10 + description: 'Leave empty to fetch your own profile.',
11 + required: false,
12 + type: 6
13 + }
14 + ],
15 +
16 + run: async (client) => {
17 +
18 + let member = await client.interaction.options.getMember('user') || client.interaction.user;
19 +
20 + await fetch(`${client.config.Cordx.Domains.beta}api/user/stats?userId=${member.id}`)
21 + .then(res => res.json())
22 + .then(data => {
23 +
24 + let remains = 2000 - data.used;
25 + let images = data.images;
26 + let downloads = data.downloads;
27 + let videos = data.videos;
28 +
29 + return client.interaction.reply({
30 + embeds: [
31 + new client.Gateway.EmbedBuilder()
32 + .setTitle(`Profile for: ${member.globalName ? member.globalName : member.user.globalName}`)
33 + .setColor(client.colors.base)
34 + .setThumbnail(member.displayAvatarURL({ dynamic: true }))
35 + .setDescription(`You can view the profile [here](https://dev.cordx.lol/${member.id})`)
36 + .addFields({
37 + name: 'Stored Images',
38 + value: `${images ? images : 0} total`,
39 + inline: true
40 + },{
41 + name: 'Stored Downloads',
42 + value: `${downloads ? downloads : 0} total`,
43 + inline: true
44 + },{
45 + name: 'Stored Videos',
46 + value: `${videos ? videos : 0} total`,
47 + inline: true
48 + },{
49 + name: 'Storage Limit',
50 + value: `2,000MB`,
51 + inline: true
52 + },{
53 + name: 'Storage Used',
54 + value: `${data.used.toLocaleString()}MB`,
55 + inline: true
56 + }, {
57 + name: 'Storage Available',
58 + value: `${remains.toLocaleString()}MB`,
59 + inline: true
60 + })
61 + .setTimestamp()
62 + .setFooter({
63 + text: client.footer,
64 + iconURL: client.logo
65 + })
66 + ]
67 + })
68 + })
69 + .catch((e) => {
70 +
71 + return client.interaction.reply({
72 + embeds: [
73 + new client.Gateway.EmbedBuilder()
74 + .setTitle('Error: api unavailable')
75 + .setColor(client.colors.error)
76 + .setThumbnail(client.logo)
77 + .setDescription('Hold up, either i was unable to locate your data or our API is down. Have you logged in or created an account? If you have you can check our status below')
78 + .addFields({
79 + name: 'Error',
80 + value: `${e.message}`,
81 + inline: true,
82 + },{
83 + name: 'View Our Status',
84 + value: `[click me](https://beta.cordx.lol/status) or run the "/status" command.`
85 + })
86 + .setTimestamp()
87 + .setFooter({
88 + text: client.footer,
89 + iconURL: client.logo
90 + })
91 + ]
92 + })
93 + })
94 + }
95 + }
Новее Позже