-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.js
116 lines (115 loc) · 2.96 KB
/
stats.js
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//gives a link to the source code on github
module.exports = function command(bot, info)
{
'use strict';
return {
inline: true,
alias: ['s'],
description: '(Returns some bot stats)',
permissions: 'public',
action: function(details)
{
let now = new Date();
const convertDate = function(ms)
{
let str = '';
let x = ms / 1000;
let seconds = Math.floor(x % 60);
x /= 60;
let minutes = Math.floor(x % 60);
x /= 60;
let hours = Math.floor(x % 24);
x /= 24;
let days = Math.floor(x);
if(days > 0)
{
str += `${days}d`;
}
if(hours > 0)
{
str += `${hours}h`;
}
if(minutes > 0)
{
str += `${minutes}m`;
}
if(seconds > 0)
{
str += `${seconds}s`;
}
return str;
};
const countUsers = function()
{
let num = 0;
Object.keys(bot.servers).forEach(function(key)
{
num += bot.servers[key].member_count;
});
return num;
};
const getFeathers = function()
{
let s = Object.keys(info.feathers).map((key) =>
{
return key;
}).join(',');
return s;
};
bot.sendMessage({
to: details.channelID,
embed: {
title: 'Game Shogun\'s Stats',
description: '',
footer: {
text: 'Created by CyberRonin#5517'
},
thumbnail: {
url: 'https://cdn.discordapp.com/avatars/266929822385569792/aa6e7430c7581c37573ce3a007123593.jpg'
},
fields:[
{
name: 'Servers',
value: Object.keys(bot.servers).length,
inline: true
},
{
name: 'Channels',
value: Object.keys(bot.channels).length,
inline: true
},
{
name: 'Users',
value: countUsers(),
inline: true
},
{
name: 'Commands',
value: Object.keys(info.commands).length,
inline: true
},
{
name: 'Uptime',
value: convertDate(now - info.start),
inline: true
},
{
name: 'Discord Server',
value: 'https://discord.gg/jDpR9PD',
inline: true
},
{
name: 'Feathers Loaded',
value: getFeathers()
},
{
name: 'About',
value: 'Primary purpose is to have a bot that will be useful when gaming. The first implementation will be League of Legends!',
inline: false
}
]
}
});
}
};
};