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

Commit 07f1419

Browse files
committed
Version 1.9.0
New UI for listing, Kick Confirmation and more!
1 parent 4e5ab40 commit 07f1419

File tree

9 files changed

+399
-109
lines changed

9 files changed

+399
-109
lines changed

commands/emmessage.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports.run = async (bot, message, args) => {
88
message.reply("You cannot use " + config.prefix + "emmessage command beacuse of the cooldown.")
99
} else {
1010
if (message.content.toLowerCase().startsWith(config.prefix + "emmessage")) {
11-
//check if no perm
11+
1212
if(message.author.id !== config.ownerid){
1313
return message.reply("You're not my developer to do that!");
1414
}
@@ -17,7 +17,6 @@ module.exports.run = async (bot, message, args) => {
1717
const contentmsg = contentmsga.substr(9);
1818
var Attachment = (message.attachments);
1919

20-
//check if there's attachment
2120
if(message.attachments.size > 0){
2221
const MEAEmbed = new Discord.MessageEmbed()
2322
.setColor('#b491c8')
@@ -35,8 +34,7 @@ module.exports.run = async (bot, message, args) => {
3534

3635
return bot.guilds.cache.array().forEach(guild => guild.owner.send(MEAEmbed));
3736
}
38-
39-
//this will run if no attachment
37+
4038
const MEEmbed = new Discord.MessageEmbed()
4139
.setColor('#b491c8')
4240
.setTitle('Prune Bot | Announcement')
@@ -55,7 +53,7 @@ module.exports.run = async (bot, message, args) => {
5553
usedCommand.add(message.author.id);
5654
setTimeout(() => {
5755
usedCommand.delete(message.author.id);
58-
}, 5000); //You can set the ammount of the cooldown here! Its Formated to Miliseconds.
56+
}, 5000);
5957
}
6058
}
6159

commands/fetch.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports.run = async (bot, message, args) => {
88
message.reply("You cannot use " + config.prefix + "fetch command beacuse of the cooldown.")
99
} else {
1010
if (message.content.toLowerCase().startsWith(config.prefix + "fetch")) {
11-
//check if no perm
11+
1212
if(!message.member.hasPermission("ADMINISTRATOR")){
1313
return message.reply("You don't have `ADMINISTRATOR` permission to do that!");
1414
}
@@ -21,7 +21,7 @@ module.exports.run = async (bot, message, args) => {
2121
usedCommand.add(message.author.id);
2222
setTimeout(() => {
2323
usedCommand.delete(message.author.id);
24-
}, 300000); //You can set the ammount of the cooldown here! Its Formated to Miliseconds 300000 = 5mins.
24+
}, 300000);
2525
}
2626
}
2727

commands/knorole.js

Lines changed: 114 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,135 @@ module.exports.run = async (bot, message, args) => {
88
message.reply("You cannot use " + config.prefix + "knorole command beacuse of the cooldown.")
99
} else {
1010
if (message.content.toLowerCase().startsWith(config.prefix + "knorole")) {
11-
//check if no perm
11+
1212
if(!message.member.hasPermission("ADMINISTRATOR")){
1313
return message.reply("You don't have `ADMINISTRATOR` permission to do that!");
1414
}
15-
//count members will be kicked
15+
1616
var memberscount = message.guild.members.cache.filter(member => member.roles.cache.array().length < 2).size;
1717

1818
if (memberscount == 0){
1919
message.reply('Looks like everyone has a role already.')
2020
}
2121
else{
22+
const ListEmbed = new Discord.MessageEmbed()
23+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
24+
.setDescription(`Users that has no role: \n` + getUsers(page))
25+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
26+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
27+
.setColor('#b491c8')
28+
.setFooter('| ◀️ Back | ▶️ Next | 👍 Confirm | 👎 Cancel', 'https://i.imgur.com/DxWDaGv.png');
29+
var listMsg = await message.channel.send(ListEmbed);
30+
var page = parseInt(args[0]);
31+
if (!page) {
32+
page = 1;
33+
};
34+
await listMsg.react("◀️");
35+
await listMsg.react("▶️");
36+
await listMsg.react("👍");
37+
await listMsg.react("👎");
38+
const filter = (reaction, user) => ["◀️", "▶️", "👍","👎"].includes(reaction.emoji.name) && user.id === message.author.id;
39+
const collector = listMsg.createReactionCollector(filter, {
40+
time: 120000
41+
});
42+
collector.on('collect', (reaction, user) => {
43+
reaction.emoji.reaction.users.remove(user.id);
44+
switch (reaction.emoji.name) {
45+
case "◀️":
46+
--page;
47+
if (page < 1) {
48+
page = 1;
49+
};
50+
const newlistMsga = new Discord.MessageEmbed()
51+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
52+
.setDescription(`Users that has no role: \n` + getUsers(page))
53+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
54+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
55+
.setColor('#b491c8')
56+
.setFooter('| ◀️ Back | ▶️ Next | 👍 Confirm | 👎 Cancel', 'https://i.imgur.com/DxWDaGv.png');
57+
listMsg.edit(newlistMsga);
58+
break;
59+
case "▶️":
60+
61+
++page;
62+
const newlistMsgb = new Discord.MessageEmbed()
63+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
64+
.setDescription(`Users that has no role: \n` + getUsers(page))
65+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
66+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
67+
.setColor('#b491c8')
68+
.setFooter('| ◀️ Back | ▶️ Next | 👍 Confirm | 👎 Cancel', 'https://i.imgur.com/DxWDaGv.png');
69+
listMsg.edit(newlistMsgb);
70+
break;
71+
case "👍":
72+
const ukicked = new Discord.MessageEmbed()
73+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
74+
.setDescription(`Users that has no role.`)
75+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
76+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
77+
.setColor('#b491c8')
78+
.addFields(
79+
{ name: 'Operation Successful', value: memberscount + " user(s) has been kicked."}
80+
)
81+
.setFooter('PruneBot is created by Mashwishi', 'https://i.imgur.com/DxWDaGv.png');
82+
let members = message.guild.members.cache.filter(member => member.roles.cache.array().length < 2)
83+
members.forEach(m => {
84+
m.kick()
85+
.catch(console.error);
86+
});
87+
listMsg.reactions.removeAll();
88+
listMsg.edit(ukicked);
89+
break;
90+
case "👎":
91+
const cancel = new Discord.MessageEmbed()
92+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
93+
.setDescription(`Users that has no role.`)
94+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
95+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
96+
.setColor('#b491c8')
97+
.addFields(
98+
{ name: 'Operation Cancelled', value: "No users has been kicked."}
99+
)
100+
.setFooter('PruneBot is created by Mashwishi', 'https://i.imgur.com/DxWDaGv.png');
101+
102+
listMsg.reactions.removeAll();
103+
listMsg.edit(cancel);
104+
break;
105+
};
106+
});
107+
collector.on('end', collected => {
108+
109+
const done = new Discord.MessageEmbed()
110+
.setTitle('Prune Bot | Total of '+ memberscount +' User(s)')
111+
.setDescription(`Users that has no role.`)
112+
.setAuthor('Join our Discord Server', 'https://i.imgur.com/hKeHeEy.gif', 'https://discord.io/LIMYAW')
113+
.setThumbnail('https://i.imgur.com/ypxq7B9.png')
114+
.setColor('#b491c8')
115+
.addFields(
116+
{ name: 'Reaction Timeout', value: "I'm done looking for reactions on the message!"}
117+
)
118+
.setFooter('PruneBot is created by Mashwishi', 'https://i.imgur.com/DxWDaGv.png');
119+
//return
120+
listMsg.reactions.removeAll();
121+
listMsg.edit(done);
122+
});
123+
function getUsers(n) {
124+
const list = message.guild.members.cache.filter(member => member.roles.cache.array().length < 2).map(member => member.user.tag);
125+
var pageNum = (n * 10) - 10;
126+
if (!pageNum) {
127+
pageNum = 0;
128+
};
129+
return list.slice(pageNum, pageNum + 9).join("\n");
130+
};
131+
132+
22133

23-
//const ListEmbed = new Discord.MessageEmbed()
24-
// .setTitle(`Prune Bot | Users`)
25-
//.setDescription(`The bot will kick (`+ memberscount +`) users without a role.`)
26-
// .setColor('#b491c8')
27-
// .addFields(
28-
// { name: 'Users:', value: message.guild.members.cache.filter(member => member.roles.cache.array().length < 2).map(member => member.user.tag).join('\n') },)
29-
// .setFooter('PruneBot is created by Mashwishi', 'https://i.imgur.com/DxWDaGv.png');
30-
// message.channel.send(ListEmbed);
31-
message.reply('The bot will kick ('+ memberscount +') users without a role.\n'+ 'Confirm with a thumb up or deny with a thumb down.')
32-
message.react('👍').then(r => {
33-
message.react('👎');
34-
});
35-
// confirmation of the task
36-
message.awaitReactions((reaction, user) => user.id == message.author.id && (reaction.emoji.name == '👍' || reaction.emoji.name == '👎'),
37-
{ max: 1, time: 30000 }).then(collected => {
38-
if (collected.first().emoji.name == '👍') {
39-
let members = message.guild.members.cache.filter(member => member.roles.cache.array().length < 2)
40-
members.forEach(m => {
41-
m.kick()
42-
.catch(console.error);
43-
});
44-
message.reply('Done! ('+ memberscount +') users without roles has been kicked.');
45-
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
46-
}
47-
else
48-
message.reply('Operation canceled.');
49-
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
50-
}).catch(() => {
51-
message.reply('No reaction after 30 seconds, operation canceled');
52-
message.reactions.removeAll().catch(error => console.error('Failed to clear reactions: ', error));
53-
});
54134
}
55135
}
56136
usedCommand.add(message.author.id);
57137
setTimeout(() => {
58138
usedCommand.delete(message.author.id);
59-
}, 5000); //You can set the ammount of the cooldown here! Its Formated to Miliseconds 5000 = 5secs.
139+
}, 5000);
60140
}
61141
}
62142

0 commit comments

Comments
 (0)