-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ca9c6b8
commit 0c86ced
Showing
32 changed files
with
1,067 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const { | ||
ChatInputCommandInteraction, | ||
SlashCommandBuilder, | ||
EmbedBuilder, | ||
PermissionFlagsBits, | ||
Client, | ||
} = require("discord.js"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("ban") | ||
.setDescription("Ban a user.") | ||
.setDefaultMemberPermissions(PermissionFlagsBits.BanMembers) | ||
.addUserOption((option) => | ||
option | ||
.setName("target") | ||
.setDescription("Provide a target.") | ||
.setRequired(true) | ||
) | ||
.addStringOption((option) => | ||
option.setName("reason").setDescription("Provide a reason.") | ||
), | ||
/** | ||
* @param {ChatInputCommandInteraction} interaction | ||
* @param {Client} client | ||
*/ | ||
async execute(interaction, client) { | ||
const { options } = interaction; | ||
const target = options.getMember("target"); | ||
const reason = options.getString("reason") || "No reason specified."; | ||
|
||
const higherEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription( | ||
"🔹 | You can't ban someone with a role higher than yours." | ||
) | ||
.setTimestamp(); | ||
|
||
const evenHigherEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription("🔹 | I can't ban someone with a role higher than mine.") | ||
.setTimestamp(); | ||
|
||
if ( | ||
target.roles.highest.position >= interaction.member.roles.highest.position | ||
) | ||
return interaction.reply({ embeds: [higherEmbed], ephemeral: true }); | ||
if ( | ||
target.roles.highest.position >= | ||
interaction.guild.members.me.roles.highest.position | ||
) | ||
return interaction.reply({ embeds: [evenHigherEmbed], ephemeral: true }); | ||
|
||
const bannedEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setTitle(`${client.user.username} | Notice`) | ||
.setDescription( | ||
`You have been banned from ${interaction.guild.name} for ${reason}` | ||
) | ||
.setTimestamp(); | ||
|
||
const successEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription(`${target.user.tag} has been banned for ${reason}.`) | ||
.setTimestamp(); | ||
|
||
target.send({ embeds: [bannedEmbed] }).catch(_err); | ||
|
||
return interaction.reply({ embeds: [successEmbed] }).then(() => { | ||
target.ban({ reason }); | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
const { | ||
ChatInputCommandInteraction, | ||
SlashCommandBuilder, | ||
EmbedBuilder, | ||
PermissionFlagsBits, | ||
Client, | ||
} = require("discord.js"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("kick") | ||
.setDescription("Kick a user.") | ||
.setDefaultMemberPermissions(PermissionFlagsBits.KickMembers) | ||
.addUserOption((option) => | ||
option | ||
.setName("target") | ||
.setDescription("Provide a target.") | ||
.setRequired(true) | ||
) | ||
.addStringOption((option) => | ||
option.setName("reason").setDescription("Provide a reason.") | ||
), | ||
/** | ||
* @param {ChatInputCommandInteraction} interaction | ||
* @param {Client} client | ||
*/ | ||
async execute(interaction, client) { | ||
const { options } = interaction; | ||
const target = options.getMember("target"); | ||
const reason = options.getString("reason") || "No reason specified."; | ||
|
||
const higherEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription( | ||
"🔹 | You can't kick someone with a role higher than yours." | ||
) | ||
.setTimestamp(); | ||
|
||
const evenHigherEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription("🔹 | I can't kick someone with a role higher than mine.") | ||
.setTimestamp(); | ||
|
||
if ( | ||
target.roles.highest.position >= interaction.member.roles.highest.position | ||
) | ||
return interaction.reply({ embeds: [higherEmbed], ephemeral: true }); | ||
if ( | ||
target.roles.highest.position >= | ||
interaction.guild.members.me.roles.highest.position | ||
) | ||
return interaction.reply({ embeds: [evenHigherEmbed], ephemeral: true }); | ||
|
||
const kickedNotif = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setTitle(`${client.user.username} | Notice`) | ||
.setDescription( | ||
`You have been kicked from ${interaction.guild.name} for ${reason}` | ||
) | ||
.setTimestamp(); | ||
|
||
const successEmbed = new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription(`${target.user.tag} has been kicked for ${reason}.`) | ||
.setTimestamp(); | ||
|
||
target.send({ embeds: [kickedNotif] }).catch(_err); | ||
|
||
return interaction.reply({ embeds: [successEmbed] }).then(() => { | ||
target.kick({ reason }); | ||
}); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
const { | ||
ChatInputCommandInteraction, | ||
SlashCommandBuilder, | ||
EmbedBuilder, | ||
PermissionsBitField, | ||
} = require("discord.js"); | ||
const { ManageChannels, SendMessages } = PermissionsBitField.Flags; | ||
const DB = require("../../structures/schemas/lockdown.js"); | ||
const ms = require("ms"); | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("lock") | ||
.setDescription("Lock a channel.") | ||
.setDefaultMemberPermissions(ManageChannels) | ||
.addStringOption((option) => | ||
option | ||
.setName("time") | ||
.setDescription("How long would you like the quarantine to last?") | ||
) | ||
.addStringOption((option) => | ||
option | ||
.setName("reason") | ||
.setDescription("Provide a reason for the quarantine.") | ||
), | ||
/** | ||
* @param {ChatInputCommandInteraction} interaction | ||
*/ | ||
async execute(interaction) { | ||
const { guild, channel, options } = interaction; | ||
const reason = options.getString("reason") || "Unknown"; | ||
const time = options.getString("time"); | ||
const Embed = new EmbedBuilder(); | ||
|
||
if (!channel.permissionsFor(guild.id).has(SendMessages)) | ||
return interaction.reply({ | ||
embeds: [ | ||
Embed.setDescription("🔹 | This channel is already locked.") | ||
.setColor("Blurple") | ||
.setTimestamp(), | ||
], | ||
}); | ||
|
||
channel.permissionOverwrites.edit(guild.id, { | ||
SendMessages: false, | ||
}); | ||
interaction.reply({ | ||
embeds: [ | ||
Embed.setDescription(`🔹 | This channel is now locked for: ${reason}`) | ||
.setColor("Blurple") | ||
.setTimestamp(), | ||
], | ||
}); | ||
|
||
if (time) { | ||
const expiredate = Date.now() + ms(time); | ||
DB.create({ GuildID: guild.id, ChannelID: channel.id, Time: expiredate }); | ||
|
||
setTimeout(async () => { | ||
channel.permissionOverwrites.edit(guild.id, { | ||
SendMessages: null, | ||
}); | ||
interaction | ||
.editReply({ | ||
embeds: [ | ||
Embed.setDescription( | ||
"🔹 | This channel has been unlocked." | ||
).setColor("Blurple"), | ||
], | ||
}) | ||
.catch(() => {}); | ||
await DB.deleteOne({ ChannelID: channel.id }); | ||
}, ms(time)); | ||
} | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
const { | ||
ChatInputCommandInteraction, | ||
SlashCommandBuilder, | ||
EmbedBuilder, | ||
PermissionsBitField, | ||
} = require("discord.js"); | ||
const { ManageMessages } = PermissionsBitField.Flags; | ||
|
||
module.exports = { | ||
data: new SlashCommandBuilder() | ||
.setName("clear") | ||
.setDescription("Clear a number of messages.") | ||
.setDefaultMemberPermissions(ManageMessages) | ||
.addStringOption((options) => | ||
options | ||
.setName("number") | ||
.setDescription("Provide the number of messages you'd like to delete.") | ||
.setRequired(true) | ||
), | ||
/** | ||
* @param {ChatInputCommandInteraction} interaction | ||
*/ | ||
async execute(interaction) { | ||
const { options } = interaction; | ||
const messages = options.getString("number"); | ||
|
||
if (number > 100) | ||
return interaction.reply({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription( | ||
"🔹 | You can't delete more than 100 messages at once." | ||
) | ||
.setTimestamp(), | ||
], | ||
ephemeral: true, | ||
}); | ||
|
||
if (number < 1) | ||
return interaction.reply({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription( | ||
"🔹 | You can't delete less than 1 message at once." | ||
) | ||
.setTimestamp(), | ||
], | ||
ephemeral: true, | ||
}); | ||
|
||
await interaction.channel.bulkDelete(number, true).then(() => { | ||
return interaction.reply({ | ||
embeds: [ | ||
new EmbedBuilder() | ||
.setColor("Blurple") | ||
.setDescription(`🔹 | Cleared ${number} messages.`) | ||
.setTimestamp(), | ||
], | ||
}); | ||
}); | ||
}, | ||
}; |
Oops, something went wrong.