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

Commit dc9815e

Browse files
committed
2.1.0
1 parent 0521f86 commit dc9815e

File tree

5 files changed

+44
-31
lines changed

5 files changed

+44
-31
lines changed

commands/custom/setprefix.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports.run = async (client, message, args) => {
8181
module.exports.help = {
8282
name: "setprefix",
8383
description: "This command is used for changing the prefix.",
84-
usage: "p!setprefix <prefix>",
84+
usage: "p!setprefix <value>",
8585
accessableby: "Manage Server",
8686
aliases: [],
8787
cooldown: 10

commands/info/help.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const Discord = require("discord.js");
22

33
module.exports.run = async (client, message, args) => {
4+
45
const settings = require("../../config/settings.json");
56
const prefixesdatabase = client.settings.ensure(message.guild.id, settings);
67

@@ -41,11 +42,13 @@ module.exports.run = async (client, message, args) => {
4142
.addField(
4243
"**:partying_face: Fun**",
4344
"`8ball`, `cat`, `deaes256`, `kiss`, `meme`, `ngif`, `pat`, `poke`, `smug`, `thigh`, `tickle`"
44-
)
45+
)
46+
.addFields(
47+
{ name: 'Powered by DarkHost', value: '[Host your Discord Bot 24/7 For Free](https://discord.gg/EnXm6GaWa3)'}
48+
)
4549
.addFields(
46-
{ name: ':desktop: Github (Source Code)', value: 'https://github.com/mashwishi/PruneBot' },
47-
{ name: ':revolving_hearts: Support the Developer:', value: 'https://ko-fi.com/mashwishi' }
48-
)
50+
{ name: ':desktop: Github Project', value: '[Download Code](https://github.com/mashwishi/PruneBot)', inline: true },
51+
{ name: ':revolving_hearts: Support Project', value: '[Donate](https://ko-fi.com/mashwishi)', inline: true },)
4952
.setTitle('Prune Bot | Commands')
5053
.setFooter(${nowyear} ${client.user.username} Created by Mashwishi.\nCommand requested by: ${message.author.username}#${message.author.discriminator}`, `https://i.imgur.com/ypxq7B9.png`)
5154
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
@@ -75,7 +78,10 @@ module.exports.run = async (client, message, args) => {
7578
command.help.usage || "No Usage"
7679
}\`\`\`\n**Permissions:**\n\`\`\`${
7780
command.help.accessableby || "Members"
81+
}\`\`\`\n**Cooldown (in seconds):**\n\`\`\`${
82+
command.help.cooldown || "No Cooldown"
7883
}\`\`\`\n**Aliases:**\n\`\`\`${alia}\`\`\``
84+
7985
)
8086
.setColor("#4a4b4d")
8187
.setFooter(
@@ -98,6 +104,7 @@ module.exports.help = {
98104
description: "This command is used for displaying all commands.",
99105
usage: "p!help",
100106
accessableby: "Members",
101-
aliases: [],
102-
cooldown: 120
107+
aliases: ['?', 'commands', 'command'],
108+
cooldown: 3
103109
};
110+

events/client/message.js

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
const Discord = require("discord.js");
22
const settings = require("../../config/settings.json");
33

4-
const cooldowns = new Discord.Collection();
4+
//const cooldowns = new Discord.Collection();
5+
6+
//create cooldowns map
7+
const cooldowns = new Map();
58

69
module.exports = async (client, message) => {
710
if (message.author.bot) return;
@@ -18,44 +21,47 @@ module.exports = async (client, message) => {
1821
}
1922

2023
if (!message.content.startsWith(prefixesdatabase.prefix)) return;
21-
const command = message.content
22-
.split(" ")[0]
23-
.slice(prefixesdatabase.prefix.length);
24+
25+
let commandText = message.content.split(" ")[0].slice(prefixesdatabase.prefix.length);
26+
if (!client.commands.has(commandText)) {
27+
commandText = client.aliases.get(commandText);
28+
if (!commandText) return;
29+
}
30+
31+
const command = client.commands.get(commandText);
2432
const args = message.content.split(" ").slice(1);
25-
if (!cooldowns.has(command.name)) {
26-
cooldowns.set(command.name, new Discord.Collection());
33+
34+
if (!cooldowns.has(command.help.name)) {
35+
cooldowns.set(command.help.name, new Discord.Collection());
2736
}
37+
2838
const now = Date.now();
29-
const timestamps = cooldowns.get(command.name);
30-
const cooldownAmount = (command.cooldown || 15) * 1000;
39+
const timestamps = cooldowns.get(command.help.name);
40+
const cooldownAmount = (command.help.cooldown || 2) * 1000;
41+
3142
if (timestamps.has(message.author.id)) {
3243
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
3344
if (now < expirationTime) {
34-
const timeLeft = (expirationTime - now) / 2000;
45+
const timeLeft = (expirationTime - now) / 1000;
46+
const timeLeftfinal = new Date(timeLeft * 1000).toISOString().substr(11, 8)
3547
return message.reply(
3648
`Before using **${
3749
prefixesdatabase.prefix
38-
}${command}**, please wait for **${timeLeft.toFixed(
39-
1
40-
)} second for cooldowns!**`
41-
);
50+
}${commandText}**, please wait for **${timeLeftfinal}** second for cooldowns!`
51+
).then(m => m.delete({ timeout: 5000 }));
4252
}
4353
}
54+
4455
timestamps.set(message.author.id, now);
4556
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
46-
let cmd;
47-
if (client.commands.has(command)) {
48-
cmd = client.commands.get(command);
49-
} else if (client.aliases.has(command)) {
50-
cmd = client.commands.get(client.aliases.get(command));
51-
}
57+
5258
try {
53-
cmd.run(client, message, args);
59+
command.run(client, message, args);
5460
} catch (e) {
55-
return console.log(`Invalid command: ${command}`);
61+
return console.log(`Invalid command: ${commandText}`);
5662
} finally {
5763
console.log(
58-
`${message.author.username} using command ${prefixesdatabase.prefix}${command}`
64+
`${message.author.username} using command ${prefixesdatabase.prefix}${commandText}`
5965
);
6066
}
6167
};

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "PruneBot",
3-
"version": "1.0.0",
3+
"version": "2.1.0",
44
"main": "shard.js",
55
"description": "A free open source solution to your server and user managing problems, built from scratch with code organization and quality in mind. Our goal is to cover as many functionalities as possible.",
66
"author": "Mashwishi",

0 commit comments

Comments
 (0)