summaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/addrole.ts9
-rw-r--r--src/commands/moderation/ban.ts17
-rw-r--r--src/commands/moderation/clear.ts31
-rw-r--r--src/commands/moderation/kick.ts18
-rw-r--r--src/commands/moderation/removerole.ts10
5 files changed, 54 insertions, 31 deletions
diff --git a/src/commands/moderation/addrole.ts b/src/commands/moderation/addrole.ts
index 63f2f14..015775b 100644
--- a/src/commands/moderation/addrole.ts
+++ b/src/commands/moderation/addrole.ts
@@ -1,8 +1,9 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore this has no types
import emoji from 'emoji-random'
module.exports = class AddRoleModeration extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'addrole',
aliases: ['roleadd'],
@@ -36,8 +37,8 @@ module.exports = class AddRoleModeration extends Command {
guildOnly: true
});
}
- run(msg: CommandoMessage, { userID, roleID }) {
- msg.reply('Command disabled.')
+ run(msg: CommandoMessage, { userID, roleID }: any) {
+ return msg.reply(`Command disabled. ${emoji.random()}`)
// let role = roleID
// console.log('role:', role)
// let member = userID
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index b33a344..6bf6168 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -1,8 +1,9 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore this has no types
import emoji from 'emoji-random'
module.exports = class BanModeration extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'ban',
aliases: ['banuser', 'ban-user'],
@@ -23,19 +24,21 @@ module.exports = class BanModeration extends Command {
guildOnly: true
});
}
+ //@ts-ignore this is not promsise based
run(msg: CommandoMessage) {
let userID = msg.mentions.members?.first()
if (!userID?.id) {
- msg.reply('No member was mentioned. ' + emoji.random())
+ return msg.reply('No member was mentioned. ' + emoji.random())
} else if (userID?.id == msg.author.id) {
- msg.reply('You cannot ban yourself.' + emoji.random())
+ return msg.reply('You cannot ban yourself.' + emoji.random())
} else if (userID?.id == this.client.user?.id) {
- msg.reply('Not funny. ' + emoji.random())
+ return msg.reply('Not funny. ' + emoji.random())
} else if (!msg.guild.member(userID.id)) {
- msg.reply('Member does not exist in server.')
+ return msg.reply('Member does not exist in server.')
} else {
msg.guild.members.ban(userID.id)
- msg.say(`**${userID}** has been banned!`).then(m => {
+ return msg.say(`**${userID}** has been banned!`).then(m => {
+ //@ts-ignore yes this exists
m.react('🇫');
})
}
diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts
index 5175556..c306231 100644
--- a/src/commands/moderation/clear.ts
+++ b/src/commands/moderation/clear.ts
@@ -1,8 +1,9 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore no types
import emoji from 'emoji-random';
module.exports = class ClearModeration extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'clear',
aliases: ['delete', 'del', 'c'],
@@ -32,26 +33,35 @@ module.exports = class ClearModeration extends Command {
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES']
});
}
- async run(msg: CommandoMessage, { deleteAmount }) {
+ //@ts-ignore this is not promise based
+ async run(msg: CommandoMessage, { deleteAmount }: any) {
if (msg.member.hasPermission('MANAGE_MESSAGES')) {
if (!deleteAmount) {
- msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => {
+ return msg.reply('You haven\'t specified an amount of messages which should be deleted. ' + emoji.random()).then(deleteNotificationMessage => {
+ //@ts-ignore this exists
deleteNotificationMessage.delete({ timeout: 2000 });
+ //@ts-ignore this exists
msg.delete({ timeout: 2000 })
});
} else if (isNaN(deleteAmount)) {
- msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => {
+ return msg.reply('The amount parameter isn\'t a number. ' + emoji.random()).then(deleteNotificationMessage => {
+ //@ts-ignore this exists
deleteNotificationMessage.delete({ timeout: 2000 });
+ //@ts-ignore this exists
msg.delete({ timeout: 2000 })
});
} else if (deleteAmount > 100) {
- msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => {
+ return msg.reply('You can\'t delete more than 100 messages at once. ' + emoji.random()).then(deleteNotificationMessage => {
+ //@ts-ignore this exists
deleteNotificationMessage.delete({ timeout: 2000 });
+ //@ts-ignore this exists
msg.delete({ timeout: 2000 })
});
} else if (deleteAmount < 1) {
- msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => {
+ return msg.reply('You have to delete at least 1 message. ' + emoji.random()).then(deleteNotificationMessage => {
+ //@ts-ignore this exists
deleteNotificationMessage.delete({ timeout: 2000 });
+ //@ts-ignore this exists
msg.delete({ timeout: 2000 })
});
}
@@ -69,15 +79,18 @@ module.exports = class ClearModeration extends Command {
}).then(messages => { // I am on v11 discord.js
// why the hell did i put this msg here lol, its 07:56 on 2020/04/27 and i woke up at 6am and i dont really know
// why i put this msg here lol, i am on v12 so that msg mustve been a while ago lol
+ //@ts-ignore this exists
msg.channel.bulkDelete(messages);
});
- msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => {
+ return msg.reply('It\'s been deleted ~uwu ' + emoji.random()).then(deleteNotificationMessage => {
+ //@ts-ignore this exists
deleteNotificationMessage.delete({ timeout: 2000 });
+ //@ts-ignore this exists
msg.delete({ timeout: 2000 })
});
}
} else {
- msg.reply('Insufficent permsissions. ' + emoji.random());
+ return msg.reply('Insufficent permsissions. ' + emoji.random());
}
}
}; \ No newline at end of file
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 37d08e9..c3e57a2 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,8 +1,9 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore this has no types
import emoji from 'emoji-random'
module.exports = class KickModeration extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'kick',
aliases: ['kickuser', 'kick-user'],
@@ -23,19 +24,22 @@ module.exports = class KickModeration extends Command {
guildOnly: true
});
}
+ //@ts-ignore this aint async
run(msg: CommandoMessage) {
let userID = msg.mentions.members?.first()
if (!userID?.id) {
- msg.reply('No member was mentioned. ' + emoji.random())
+ return msg.reply('No member was mentioned. ' + emoji.random())
} else if (userID?.id == msg.author.id) {
- msg.reply('You cannot kick yourself.' + emoji.random())
+ return msg.reply('You cannot kick yourself.' + emoji.random())
} else if (userID?.id == this.client.user?.id) {
- msg.reply('Not funny. ' + emoji.random())
+ return msg.reply('Not funny. ' + emoji.random())
} else if (!msg.guild.member(userID.id)) {
- msg.reply('Member does not exist in server.')
+ return msg.reply('Member does not exist in server.')
} else {
+ //@ts-ignore stupid typescript error this exists
msg.guild.members.prune(userID.id)
- msg.say(`**${userID}** has been kicked!`).then(m => {
+ return msg.say(`**${userID}** has been kicked!`).then(m => {
+ //@ts-ignore this exists
m.react('🇫');
})
}
diff --git a/src/commands/moderation/removerole.ts b/src/commands/moderation/removerole.ts
index d86dbf2..e8a950c 100644
--- a/src/commands/moderation/removerole.ts
+++ b/src/commands/moderation/removerole.ts
@@ -1,7 +1,9 @@
-import { Command, CommandoMessage } from 'discord.js-commando';
+import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
+//@ts-ignore no types
+import emoji from 'emoji-random';
module.exports = class RemoveRoleModeration extends Command {
- constructor(client) {
+ constructor(client: CommandoClient) {
super(client, {
name: 'removerole',
aliases: ['roleremove'],
@@ -35,8 +37,8 @@ module.exports = class RemoveRoleModeration extends Command {
]
});
}
- run(msg: CommandoMessage, { userID, roleID }) {
- msg.reply('Command disabled.')
+ run(msg: CommandoMessage, { userID, roleID }: any) {
+ return msg.reply(`Command disabled. ${emoji.random()}`)
// let role = roleID
// console.log('role:', role)
// let member = userID