Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit b6908ce

Browse files
committed
feat: Improved stats and rules command
1 parent 799ce49 commit b6908ce

File tree

2 files changed

+43
-72
lines changed

2 files changed

+43
-72
lines changed

src/Commands/Information/rules.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,25 @@ export default {
88
.setDescription('Sends rules of the bot and chat network'),
99
async execute(interaction: ChatInputCommandInteraction) {
1010
const embed = new EmbedBuilder()
11-
.setTitle('ChatBot Rules')
11+
.setTitle(`${interaction.client.emoji.normal.clipart} ChatBot Rules`)
1212
.setDescription(
1313
stripIndents`
1414
1. No spamming or flooding.
15-
2. Do not bring private matters into this chat.
16-
4. Do not DM the developers for unnecessary reasons.
15+
2. Refrain from insulting other users.
16+
3. Advertising of any kind is not allowed.
17+
4. Do not bring private matters into this chat.
1718
5. Do not make the chat uncomfortable for other users.
18-
6. Do not use the bot for any other purpose than fun.
19-
7. Profanity and slurs are not allowed while using the network.
20-
8. Use the **suggest** command for suggestions and the **report** command for reporting only.
21-
9. Use the **connect** command in only channels which are supposed to be receiving messages.
22-
10. Advertising is not allowed.
23-
11. Refrain from insulting other users.
24-
12. The decision of the staff is final.
25-
13. Posting inappropriate content is not allowed, and will get you blacklisted. This includes images, videos, and messages.
26-
14. Respect the staff and moderators of the chat network.
27-
15. We ask that you only use English when using our ChatBot. Should the need arise, our staff can take action.
28-
16. Bypassing any of the rules will lead to a ban.
19+
6. Profanity and slurs are not allowed while using the network.
20+
7. Be respectful of the decisions made by chat network moderators.
21+
8. Any content deemed explicit/NSFW are prohibited and will get you blacklisted.
22+
9. Use the **setup** command in only channels which are supposed to be receiving messages.
23+
10. Use the **suggest** command for suggestions and the **report** command for reporting only.
24+
11. We ask that you only use English when using our ChatBot. Should the need arise, our staff can take action.
2925
30-
*If you have any questions, please join the [support server](https://discord.gg/6bhXQynAPs).*
31-
`,
26+
*If you have any questions, please join the [support server](https://discord.gg/6bhXQynAPs).*`,
3227
)
3328
.setColor(colors('chatbot'))
34-
.setImage('https://images-ext-2.discordapp.net/external/k9bElI9Z2mxhi2DTO783PI-wj00ledbPPvzZE-gPG2k/https/media.discordapp.net/attachments/770258662694060032/799566242276704287/standard_9.gif?width=400&height=51')
35-
.setAuthor({
36-
name: interaction.client.user?.tag as string,
37-
iconURL: interaction.client.user?.avatarURL() as string,
38-
})
29+
.setImage('https://i.imgur.com/D2pYagc.png')
3930
.setFooter({ text: 'Note: Rules not explicitly mentioned here may apply as well.', iconURL:'https://cdn.discordapp.com/emojis/950424770229440533.png?&quality=lossless' });
4031
await interaction.reply({ embeds: [embed], ephemeral: true });
4132

src/Commands/Information/stats.ts

Lines changed: 31 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
import { ChatInputCommandInteraction, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
22
import { connectedListDocument } from '../../Utils/typings/types';
3+
import { stripIndents } from 'common-tags';
34
import utils from '../../Utils/functions/utils';
5+
import os from 'os';
46

57
export default {
68
data: new SlashCommandBuilder()
79
.setName('stats')
810
.setDescription('Shows the bot\'s statistics'),
911
async execute(interaction: ChatInputCommandInteraction) {
1012
const uptime = utils.toHuman(interaction.client?.uptime as number);
13+
const osUptime = utils.toHuman(os.uptime() * 1000);
1114
const database = utils.getDb();
1215
const connectedList = database?.collection('connectedList');
1316
const count = await connectedList?.countDocuments();
1417
const allConnected = await connectedList?.find({}).toArray();
1518

19+
const docsLink = 'https://discord-chatbot.gitbook.io/docs';
20+
const inviteLink = 'https://discord.com/api/oauth2/authorize?client_id=769921109209907241&permissions=154820537425&scope=bot%20applications.commands';
21+
const supportServer = 'https://discord.gg/6bhXQynAPs';
22+
1623
let connectedMembers = 0;
1724
for (const guildEntry of allConnected as connectedListDocument[]) {
1825
let guild;
@@ -25,65 +32,38 @@ export default {
2532
connectedMembers = connectedMembers + guild.memberCount;
2633
}
2734

28-
2935
const embed = new EmbedBuilder()
3036
.setAuthor({ name: `${interaction.client.user?.username} Statistics`, iconURL: interaction.client.user?.avatarURL() as string })
31-
.setColor(utils.colors())
37+
.setColor(utils.colors('chatbot'))
38+
.setDescription(`[Invite](${inviteLink}) • [Support](${supportServer}) • [Docs](${docsLink})`)
3239
.addFields([
3340
{
34-
name: 'Uptime',
35-
value: uptime,
36-
inline: true,
37-
},
38-
{
39-
name: 'Memory Usage',
40-
value: `${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB / 1 GB`,
41-
inline: true,
42-
},
43-
{
44-
name: 'Ping',
45-
value: `${interaction.client.ws.ping}ms`,
46-
inline: true,
47-
},
48-
{
49-
name: 'Guilds',
50-
value: `${interaction.client.guilds.cache.size}`,
51-
inline: true,
52-
},
53-
{
54-
name: 'Users',
55-
value: `${interaction.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)}`,
56-
inline: true,
57-
},
58-
{
59-
name: 'Commands',
60-
value: `${interaction.client.commands.size}`,
61-
inline: true,
62-
},
63-
{
64-
name: 'Bot Version',
65-
value: `v${interaction.client.version}`,
66-
inline: true,
67-
},
68-
{
69-
name: 'Discord.JS',
70-
value: `v${require('discord.js/package.json').version}`,
71-
inline: true,
72-
},
73-
{
74-
name: 'Node.JS',
75-
value: `${process.version}`,
76-
inline: true,
41+
name: 'System',
42+
value: stripIndents`\`\`\`elm
43+
CPU: ${os.cpus()[0].model}
44+
Memory: ${Math.round(process.memoryUsage().heapUsed / 1024 / 1024)} MB / 1.75 GB
45+
Uptime: ${osUptime}
46+
Discord.JS: ${require('discord.js/package.json').version}
47+
Node.JS: ${process.version}
48+
\`\`\``,
7749
},
7850
{
79-
name: 'Connected Servers',
80-
value: String(count),
81-
inline: true,
51+
name: 'Bot',
52+
value: stripIndents`\`\`\`elm
53+
Ping: ${interaction.client.ws.ping}ms
54+
Uptime: ${uptime}
55+
Servers: ${interaction.client.guilds.cache.size}
56+
Users: ${interaction.client.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)}
57+
Commands: ${interaction.client.commands.size}
58+
Bot Version: v${interaction.client.version}
59+
\`\`\``,
8260
},
8361
{
84-
name: 'Connected Members',
85-
value: String(connectedMembers),
86-
inline: true,
62+
name: 'Chat Network',
63+
value: stripIndents`\`\`\`elm
64+
Servers: ${count}
65+
Members: ${connectedMembers}
66+
\`\`\``,
8767
},
8868
]);
8969
await interaction.reply({ embeds: [embed] });

0 commit comments

Comments
 (0)