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

Commit 0521f86

Browse files
committed
Merge branch 'master' of https://github.com/mashwishi/PruneBot
2 parents b23c040 + 761352b commit 0521f86

File tree

7 files changed

+32
-96
lines changed

7 files changed

+32
-96
lines changed

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
worker: node shard.js

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 <value>",
84+
usage: "p!setprefix <prefix>",
8585
accessableby: "Manage Server",
8686
aliases: [],
8787
cooldown: 10

commands/emmessage.js

Lines changed: 0 additions & 52 deletions
This file was deleted.

commands/info/help.js

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

33
module.exports.run = async (client, message, args) => {
4-
54
const settings = require("../../config/settings.json");
65
const prefixesdatabase = client.settings.ensure(message.guild.id, settings);
76

@@ -42,13 +41,11 @@ module.exports.run = async (client, message, args) => {
4241
.addField(
4342
"**:partying_face: Fun**",
4443
"`8ball`, `cat`, `deaes256`, `kiss`, `meme`, `ngif`, `pat`, `poke`, `smug`, `thigh`, `tickle`"
45-
)
46-
.addFields(
47-
{ name: 'Powered by DarkHost', value: '[Host your Discord Bot 24/7 For Free](https://discord.gg/EnXm6GaWa3)'}
48-
)
44+
)
4945
.addFields(
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 },)
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+
)
5249
.setTitle('Prune Bot | Commands')
5350
.setFooter(${nowyear} ${client.user.username} Created by Mashwishi.\nCommand requested by: ${message.author.username}#${message.author.discriminator}`, `https://i.imgur.com/ypxq7B9.png`)
5451
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
@@ -78,10 +75,7 @@ module.exports.run = async (client, message, args) => {
7875
command.help.usage || "No Usage"
7976
}\`\`\`\n**Permissions:**\n\`\`\`${
8077
command.help.accessableby || "Members"
81-
}\`\`\`\n**Cooldown (in seconds):**\n\`\`\`${
82-
command.help.cooldown || "No Cooldown"
8378
}\`\`\`\n**Aliases:**\n\`\`\`${alia}\`\`\``
84-
8579
)
8680
.setColor("#4a4b4d")
8781
.setFooter(
@@ -104,7 +98,6 @@ module.exports.help = {
10498
description: "This command is used for displaying all commands.",
10599
usage: "p!help",
106100
accessableby: "Members",
107-
aliases: ['?', 'commands', 'command'],
108-
cooldown: 3
101+
aliases: [],
102+
cooldown: 120
109103
};
110-

events/client/message.js

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

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

96
module.exports = async (client, message) => {
107
if (message.author.bot) return;
@@ -21,47 +18,44 @@ module.exports = async (client, message) => {
2118
}
2219

2320
if (!message.content.startsWith(prefixesdatabase.prefix)) return;
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);
21+
const command = message.content
22+
.split(" ")[0]
23+
.slice(prefixesdatabase.prefix.length);
3224
const args = message.content.split(" ").slice(1);
33-
34-
if (!cooldowns.has(command.help.name)) {
35-
cooldowns.set(command.help.name, new Discord.Collection());
25+
if (!cooldowns.has(command.name)) {
26+
cooldowns.set(command.name, new Discord.Collection());
3627
}
37-
3828
const now = Date.now();
39-
const timestamps = cooldowns.get(command.help.name);
40-
const cooldownAmount = (command.help.cooldown || 2) * 1000;
41-
29+
const timestamps = cooldowns.get(command.name);
30+
const cooldownAmount = (command.cooldown || 15) * 1000;
4231
if (timestamps.has(message.author.id)) {
4332
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
4433
if (now < expirationTime) {
45-
const timeLeft = (expirationTime - now) / 1000;
46-
const timeLeftfinal = new Date(timeLeft * 1000).toISOString().substr(11, 8)
34+
const timeLeft = (expirationTime - now) / 2000;
4735
return message.reply(
4836
`Before using **${
4937
prefixesdatabase.prefix
50-
}${commandText}**, please wait for **${timeLeftfinal}** second for cooldowns!`
51-
).then(m => m.delete({ timeout: 5000 }));
38+
}${command}**, please wait for **${timeLeft.toFixed(
39+
1
40+
)} second for cooldowns!**`
41+
);
5242
}
5343
}
54-
5544
timestamps.set(message.author.id, now);
5645
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
57-
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+
}
5852
try {
59-
command.run(client, message, args);
53+
cmd.run(client, message, args);
6054
} catch (e) {
61-
return console.log(`Invalid command: ${commandText}`);
55+
return console.log(`Invalid command: ${command}`);
6256
} finally {
6357
console.log(
64-
`${message.author.username} using command ${prefixesdatabase.prefix}${commandText}`
58+
`${message.author.username} using command ${prefixesdatabase.prefix}${command}`
6559
);
6660
}
6761
};

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": "2.1.0",
3+
"version": "1.0.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)