Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 63de3c3

Browse files
author
Killerclaws12
committed
changes
1 parent 68d6c29 commit 63de3c3

File tree

5 files changed

+86
-2
lines changed

5 files changed

+86
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ data/server/fullchain.pem
55
data/server/privkey.pem
66
.env
77
.vscode
8+
./Commands/Administrator/Giveaway

Commands/Information/botinfo.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ module.exports = {
6464
},
6565
{
6666
name: `Links`,
67-
value: '<:github:1109625282752688189> [**Github**](https://github.com/Guardians-Stuff/Guardian)\n<:blurple_link:1115463946565079040> [**Invite**](https://discord.com/oauth2/authorize?client_id=1093047924172279900&scope=bot)',
67+
value: '<:github:1109625282752688189> [**Github**](https://github.com/Guardians-Stuff/Guardian)\n<:blurple_link:1115463946565079040> [**Invite**](https://discord.com/oauth2/authorize?client_id=1130480504097996832&scope=bot)',
6868
inline: true,
6969
}
7070
)

Commands/Information/invite.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
*/
1414
execute(interaction, client) {
1515
return EmbedGenerator.basicEmbed(
16-
`[Click me for the invite to the bot!](https://discord.com/oauth2/authorize?client_id=1093047924172279900&scope=bot)`
16+
`[Click me for the invite to the bot!](https://discord.com/oauth2/authorize?client_id=1130480504097996832&scope=bot)`
1717
);
1818
},
1919
};

Commands/Moderator/clearChannel.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
2+
3+
module.exports = {
4+
data: new SlashCommandBuilder()
5+
.setName("clearchannel")
6+
.setDescription("Clear all messages in the channel")
7+
.setDMPermission(false),
8+
9+
async execute(interaction) {
10+
// check if user has permission to use the command
11+
if (
12+
!interaction.member.permissions.has(PermissionsBitField.ManageMessages)
13+
) {
14+
return interaction.reply({
15+
content: "you do not have permission to use this command.",
16+
ephemeral: true, // only visible to the user who executed the command
17+
});
18+
}
19+
20+
// defer the reply to reduce API overhead
21+
await interaction.deferReply({ ephemeral: true });
22+
23+
// get the channel and initialize a counter for deleted messages
24+
const channel = interaction.channel;
25+
let deletedSize = 0;
26+
27+
// loop through messages and delete them in batches of 100
28+
while (true) {
29+
const fetchedMessages = await channel.messages.fetch({ limit: 100 });
30+
if (fetchedMessages.size === 0) break;
31+
32+
const deletedMessages = await channel.bulkDelete(fetchedMessages, true);
33+
if (deletedMessages.size === 0) break;
34+
35+
deletedSize += deletedMessages.size;
36+
}
37+
38+
return interaction.followUp({
39+
content: `successfully deleted **${deletedSize}** messages in this channel.`,
40+
});
41+
},
42+
};

Commands/Moderator/hide.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const { SlashCommandBuilder } = require('@discordjs/builders');
2+
const { EmbedBuilder, PermissionFlagsBits, ChannelType } = require('discord.js');
3+
4+
module.exports = {
5+
6+
data: new SlashCommandBuilder()
7+
.setName('hide')
8+
.setDescription('hide a text channel.')
9+
.addChannelOption(option =>
10+
option.setName('channel')
11+
.setDescription('Text channel mention to hide.')
12+
.setRequired(true)
13+
.addChannelTypes(ChannelType.GuildText)
14+
),
15+
16+
async execute(interaction, client) {
17+
18+
if (!interaction.member.permissions.has(PermissionFlagsBits.ManageChannels)) return interaction.reply({
19+
embeds: [
20+
new EmbedBuilder()
21+
.setDescription("You don't have `ManageChannels` permission.")
22+
], ephemeral: true
23+
});
24+
25+
const channel = interaction.options.getChannel('channel');
26+
channel.edit({
27+
permissionOverwrites: [
28+
{ type: 'role', id: interaction.guild.roles.everyone, deny: ['ViewChannel'] },
29+
],
30+
});
31+
32+
const embed = new EmbedBuilder()
33+
.setDescription(`The Channel ${channel.name} Has Been Hidden Successfully`);
34+
35+
await interaction.reply({
36+
embeds: [embed],
37+
});
38+
39+
}
40+
41+
}

0 commit comments

Comments
 (0)