summaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
author8cy <[email protected]>2020-07-23 23:24:17 -0700
committer8cy <[email protected]>2020-07-23 23:24:17 -0700
commitbb511abc03bb66848947e37a999502b813c77269 (patch)
tree612c010fc8317e1cdf11471a18aad0270819d33e /src/commands/moderation
parentfix: if clear amount equal or over 100, round down to 99 (diff)
downloaddep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz
dep-core-bb511abc03bb66848947e37a999502b813c77269.zip
goodbye old uwufier :cry:
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/addrole.ts57
-rw-r--r--src/commands/moderation/ban.ts46
-rw-r--r--src/commands/moderation/clear.ts100
-rw-r--r--src/commands/moderation/kick.ts47
-rw-r--r--src/commands/moderation/nickname.ts53
-rw-r--r--src/commands/moderation/removerole.ts57
6 files changed, 0 insertions, 360 deletions
diff --git a/src/commands/moderation/addrole.ts b/src/commands/moderation/addrole.ts
deleted file mode 100644
index 015775b..0000000
--- a/src/commands/moderation/addrole.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-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: CommandoClient) {
- super(client, {
- name: 'addrole',
- aliases: ['roleadd'],
- group: 'moderation',
- memberName: 'addrole',
- description: '**[Disabled]** Adds a role to a specific user.',
- // args: [
- // {
- // key: 'userID',
- // prompt: 'Who would you like to add the role to? (@someone or myself)',
- // type: 'string'
- // },
- // {
- // key: 'roleID',
- // prompt: 'What role would you like to add?',
- // type: 'string'
- // }
- // ],
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- examples: [
- 'uwu!addrole @CoolRole',
- 'uwu!addrole @sin#1337 @CoolRole',
- 'uwu!roleadd @sin#1337',
- 'uwu!roleadd @sin#1337 @CoolerRole'
- ],
- throttling: {
- usages: 5,
- duration: 30
- },
- guildOnly: true
- });
- }
- run(msg: CommandoMessage, { userID, roleID }: any) {
- return msg.reply(`Command disabled. ${emoji.random()}`)
- // let role = roleID
- // console.log('role:', role)
- // let member = userID
- // console.log('member:', member)
- // if (role) {
- // if (msg.guild.member(member)?.roles.cache.some(role)) {
- // msg.reply(member + ' already has that role! ' + emoji.random())
- // } else {
- // msg.guild.member(member)?.roles.add(role).catch(err => console.log(err))
- // msg.reply(`The role **${role}** has been added to **${userID}**.`)
- // }
- // } else {
- // msg.reply('The role or user is either non-existant or you might\'ve mispelled it.')
- // }
- }
-}; \ No newline at end of file
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
deleted file mode 100644
index 6bf6168..0000000
--- a/src/commands/moderation/ban.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-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: CommandoClient) {
- super(client, {
- name: 'ban',
- aliases: ['banuser', 'ban-user'],
- group: 'moderation',
- memberName: 'ban',
- description: 'Ban someone.',
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- examples: [
- 'uwu!ban @sin#1337',
- 'uwu!banuser @sin#1337',
- 'uwu!ban-user @sin#1337'
- ],
- throttling: {
- usages: 5,
- duration: 30
- },
- guildOnly: true
- });
- }
- //@ts-ignore this is not promsise based
- run(msg: CommandoMessage) {
- let userID = msg.mentions.members?.first()
- if (!userID?.id) {
- return msg.reply('No member was mentioned. ' + emoji.random())
- } else if (userID?.id == msg.author.id) {
- return msg.reply('You cannot ban yourself.' + emoji.random())
- } else if (userID?.id == this.client.user?.id) {
- return msg.reply('Not funny. ' + emoji.random())
- } else if (!msg.guild.member(userID.id)) {
- return msg.reply('Member does not exist in server.')
- } else {
- msg.guild.members.ban(userID.id)
- return msg.say(`**${userID}** has been banned!`).then(m => {
- //@ts-ignore yes this exists
- m.react('🇫');
- })
- }
- }
-}; \ No newline at end of file
diff --git a/src/commands/moderation/clear.ts b/src/commands/moderation/clear.ts
deleted file mode 100644
index c162ac4..0000000
--- a/src/commands/moderation/clear.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-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: CommandoClient) {
- super(client, {
- name: 'clear',
- aliases: ['delete', 'del', 'c'],
- group: 'moderation',
- memberName: 'clear',
- description: 'Clears a specified amount of messages.',
- guildOnly: true,
- args: [
- {
- key: 'deleteAmount',
- prompt: 'How many messages would you like to delete?',
- type: 'integer'
- }
- ],
- examples: [
- 'uwu!clear 23',
- 'uwu!delete 75',
- 'uwu!del 32',
- 'uwu!c 45',
- 'uwu!d 84'
- ],
- throttling: {
- usages: 5,
- duration: 30
- },
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'MANAGE_MESSAGES']
- });
- }
- //@ts-ignore this is not promise based
- async run(msg: CommandoMessage, { deleteAmount }: any) {
- if (deleteAmount >= 100) {
- deleteAmount == 100;
- msg.author.send(`Due to Discord API limitations, your request has been rounded down to **100**. ${emoji.random()}`)
- }
- if (msg.member.hasPermission('MANAGE_MESSAGES')) {
- if (!deleteAmount) {
- 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)) {
- 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) {
- 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) {
- 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 })
- });
- }
- /*else if (msg.createdTimestamp > 1209600) {
- msg.reply('due to discord rules, bots can only bulk delete messages that are under 14 days old :(')
- } */
- else {
- var clearAmount = deleteAmount + 1;
- // It took me so long to figure out why this was not really working. It would delete but an insane amount at a time.
- // I realized that because it was getting parsed as a string, it would just add 1 to it so if I tried to delete 1
- // message, it would delete 11 lol. Fixed by parsing as integer THEN adding one. 02:30 2020/04/03/2020
-
- await msg.channel.messages.fetch({
- limit: clearAmount
- }).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);
- });
- 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 {
- 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
deleted file mode 100644
index c3e57a2..0000000
--- a/src/commands/moderation/kick.ts
+++ /dev/null
@@ -1,47 +0,0 @@
-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: CommandoClient) {
- super(client, {
- name: 'kick',
- aliases: ['kickuser', 'kick-user'],
- group: 'moderation',
- memberName: 'kick',
- description: 'Kick someone.',
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- examples: [
- 'uwu!kick @sin#1337',
- 'uwu!kickuser @sin#1337',
- 'uwu!kick-user @sin#1337'
- ],
- throttling: {
- usages: 5,
- duration: 30
- },
- guildOnly: true
- });
- }
- //@ts-ignore this aint async
- run(msg: CommandoMessage) {
- let userID = msg.mentions.members?.first()
- if (!userID?.id) {
- return msg.reply('No member was mentioned. ' + emoji.random())
- } else if (userID?.id == msg.author.id) {
- return msg.reply('You cannot kick yourself.' + emoji.random())
- } else if (userID?.id == this.client.user?.id) {
- return msg.reply('Not funny. ' + emoji.random())
- } else if (!msg.guild.member(userID.id)) {
- return msg.reply('Member does not exist in server.')
- } else {
- //@ts-ignore stupid typescript error this exists
- msg.guild.members.prune(userID.id)
- return msg.say(`**${userID}** has been kicked!`).then(m => {
- //@ts-ignore this exists
- m.react('🇫');
- })
- }
- }
-}; \ No newline at end of file
diff --git a/src/commands/moderation/nickname.ts b/src/commands/moderation/nickname.ts
deleted file mode 100644
index 910f7ca..0000000
--- a/src/commands/moderation/nickname.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { Command, CommandoMessage, CommandoClient } from 'discord.js-commando';
-//@ts-ignore this has no types
-import emoji from 'emoji-random'
-
-module.exports = class NicknameModeration extends Command {
- constructor(client: CommandoClient) {
- super(client, {
- name: 'nickname',
- aliases: ['nick'],
- group: 'moderation',
- memberName: 'nickname',
- description: 'Change someones nickname',
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'CHANGE_NICKNAME', 'MANAGE_NICKNAMES'],
- examples: [
- 'uwu!nickname @sin#1337 loser',
- 'uwu!nick @sin#1337 loser'
- ],
- throttling: {
- usages: 5,
- duration: 30
- },
- guildOnly: true,
- args: [
- {
- key: 'user',
- prompt: 'Which users nickname would you like to change?',
- type: 'string'
- },
- {
- key: 'nick',
- prompt: 'What would you like to change their nickname to?',
- type: 'string'
- }
- ]
- });
- }
- //@ts-ignore this aint async
- run(msg: CommandoMessage, { nick, user }: any) {
- msg.delete()
- if (msg.mentions.users) {
- user = msg.mentions.users.first()?.id
- if (nick) {
- msg.guild.members.cache.get(user)?.setNickname(nick)
- return msg.reply(`<@${user}>'s nickname has been changed to **${nick}**! ${emoji.random()}`).then(m => m.delete({ timeout: 3000 }))
- } else {
- return msg.reply(`No nickname was provided! ${emoji.random()}`)
- }
- } else {
- return msg.reply(`No valid member was mentioned! ${emoji.random()}`)
- }
- }
-}; \ No newline at end of file
diff --git a/src/commands/moderation/removerole.ts b/src/commands/moderation/removerole.ts
deleted file mode 100644
index e8a950c..0000000
--- a/src/commands/moderation/removerole.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-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: CommandoClient) {
- super(client, {
- name: 'removerole',
- aliases: ['roleremove'],
- group: 'moderation',
- memberName: 'removerole',
- description: '**[Disabled]** Removes a role from a specific user.',
- // args: [
- // {
- // key: 'userID',
- // prompt: 'Who would you like to remove the role from? (@someone or myself)',
- // type: 'string'
- // },
- // {
- // key: 'roleID',
- // prompt: 'What role would you like to remove?',
- // type: 'string'
- // }
- // ],
- throttling: {
- usages: 5,
- duration: 30
- },
- guildOnly: true,
- userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY', 'BAN_MEMBERS'],
- examples: [
- 'uwu!removerole @CoolRole',
- 'uwu!removerole @sin#1337 @CoolRole',
- 'uwu!roleremove @sin#1337',
- 'uwu!roleremove @sin#1337 @CoolerRole'
- ]
- });
- }
- run(msg: CommandoMessage, { userID, roleID }: any) {
- return msg.reply(`Command disabled. ${emoji.random()}`)
- // let role = roleID
- // console.log('role:', role)
- // let member = userID
- // console.log('member:', member)
- // if (role) {
- // if (msg.guild.member(member)?.roles.cache.some(role)) {
- // msg.reply(member + ' already has that role! ' + emoji.random())
- // } else {
- // msg.guild.member(member)?.roles.remove(role).catch(err => console.log(err))
- // msg.reply(`The role **${role}** has been remove from **${userID}**.`)
- // }
- // } else {
- // msg.reply('The role or user is either non-existant or you might\'ve mispelled it.')
- // }
- }
-}; \ No newline at end of file