summaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/ban.ts23
-rw-r--r--src/commands/moderation/kick.ts15
2 files changed, 28 insertions, 10 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 5e9be5e..b33a344 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,4 +1,5 @@
import { Command, CommandoMessage } from 'discord.js-commando';
+import emoji from 'emoji-random'
module.exports = class BanModeration extends Command {
constructor(client) {
@@ -10,21 +11,31 @@ module.exports = class BanModeration extends Command {
description: 'Ban someone.',
userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- examples: ['uwu!ban @sin#1337'],
- guildOnly: true,
+ examples: [
+ 'uwu!ban @sin#1337',
+ 'uwu!banuser @sin#1337',
+ 'uwu!ban-user @sin#1337'
+ ],
throttling: {
usages: 5,
duration: 30
},
+ guildOnly: true
});
}
run(msg: CommandoMessage) {
- let userID = msg.mentions.members?.first().id
- if (!msg.guild.member(userID)) {
+ let userID = msg.mentions.members?.first()
+ if (!userID?.id) {
+ msg.reply('No member was mentioned. ' + emoji.random())
+ } else if (userID?.id == msg.author.id) {
+ msg.reply('You cannot ban yourself.' + emoji.random())
+ } else if (userID?.id == this.client.user?.id) {
+ msg.reply('Not funny. ' + emoji.random())
+ } else if (!msg.guild.member(userID.id)) {
msg.reply('Member does not exist in server.')
} else {
- msg.guild.members.ban(userID)
- msg.say(`User **${userID}** has been banned!`).then(m => {
+ msg.guild.members.ban(userID.id)
+ msg.say(`**${userID}** has been banned!`).then(m => {
m.react('🇫');
})
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 5f6a789..37d08e9 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,4 +1,5 @@
import { Command, CommandoMessage } from 'discord.js-commando';
+import emoji from 'emoji-random'
module.exports = class KickModeration extends Command {
constructor(client) {
@@ -23,12 +24,18 @@ module.exports = class KickModeration extends Command {
});
}
run(msg: CommandoMessage) {
- let userID = msg.mentions.members?.first().id
- if (!msg.guild.member(userID)) {
+ let userID = msg.mentions.members?.first()
+ if (!userID?.id) {
+ msg.reply('No member was mentioned. ' + emoji.random())
+ } else if (userID?.id == msg.author.id) {
+ msg.reply('You cannot kick yourself.' + emoji.random())
+ } else if (userID?.id == this.client.user?.id) {
+ msg.reply('Not funny. ' + emoji.random())
+ } else if (!msg.guild.member(userID.id)) {
msg.reply('Member does not exist in server.')
} else {
- msg.guild.members.prune(userID)
- msg.say(`User **${userID}** has been kicked!`).then(m => {
+ msg.guild.members.prune(userID.id)
+ msg.say(`**${userID}** has been kicked!`).then(m => {
m.react('🇫');
})
}