aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/kick.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-06 18:30:23 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-06 18:30:23 -0400
commitc260809dadd1f45107a2b70ab6cb6c3ce12d1160 (patch)
tree67293be341953e00f6eaf9e3f56121cbd6ddb8b9 /src/commands/moderation/kick.ts
parent1dee5bcda6a43eaa7fcc88ed3b0e458f32104de4 (diff)
downloadtanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.tar.gz
tanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.tar.bz2
tanzanite-c260809dadd1f45107a2b70ab6cb6c3ce12d1160.zip
kick command
Diffstat (limited to 'src/commands/moderation/kick.ts')
-rw-r--r--src/commands/moderation/kick.ts93
1 files changed, 27 insertions, 66 deletions
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 8375198..919c14b 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,15 +1,19 @@
-import { GuildMember, Message } from 'discord.js';
-import { BushCommand } from '../../lib';
+import { BushCommand, BushGuildMember, BushMessage, BushSlashMessage, BushUser } from '../../lib';
export default class KickCommand extends BushCommand {
public constructor() {
super('kick', {
aliases: ['kick'],
category: 'moderation',
+ description: {
+ content: 'Kick a user.',
+ usage: 'kick <member> <reason>',
+ examples: ['kick @user bad']
+ },
args: [
{
id: 'user',
- type: 'member',
+ type: 'user',
prompt: {
start: 'What user would you like to kick?',
retry: '{error} Choose a valid user to kick.'
@@ -20,19 +24,13 @@ export default class KickCommand extends BushCommand {
type: 'string',
match: 'restContent',
prompt: {
- start: 'Why would you like to kick this user?',
- retry: '{error} Choose a valid user to kick.',
+ start: 'Why should this user be kicked?',
+ retry: '{error} Choose a valid kick reason.',
optional: true
}
}
],
- clientPermissions: ['KICK_MEMBERS'],
- userPermissions: ['KICK_MEMBERS'],
- description: {
- content: 'Kick a member from the server.',
- usage: 'kick <member> <reason>',
- examples: ['kick @user bad']
- },
+ slash: true,
slashOptions: [
{
type: 'USER',
@@ -43,67 +41,30 @@ export default class KickCommand extends BushCommand {
{
type: 'STRING',
name: 'reason',
- description: 'Why would you like to kick this user?',
+ description: 'Why should this user be kicked?',
required: false
}
],
- slash: true
+ clientPermissions: ['SEND_MESSAGES', 'KICK_MEMBERS'],
+ userPermissions: ['KICK_MEMBERS']
});
}
- // private async *genResponses(
- // message: Message | CommandInteraction,
- // user: GuildMember,
- // reason?: string
- // ): AsyncIterable<string> {
- // let modlogEnry: ModLog;
- // // Create guild entry so postgres doesn't get mad when I try and add a modlog entry
- // await Guild.findOrCreate({
- // where: {
- // id: message.guild.id
- // },
- // defaults: {
- // id: message.guild.id
- // }
- // });
- // try {
- // modlogEnry = ModLog.build({
- // user: user.id,
- // guild: message.guild.id,
- // moderator: message instanceof Message ? message.author.id : message.user.id,
- // type: ModLogType.KICK,
- // reason
- // });
- // await modlogEnry.save();
- // } catch (e) {
- // this.client.console.error(`KickCommand`, `Error saving to database. ${e?.stack || e}`);
- // yield `${this.client.util.emojis.error} Error saving to database. Please report this to a developer.`;
- // return;
- // }
- // try {
- // await user.send(`You were kicked in ${message.guild.name} with reason \`${reason || 'No reason given'}\``);
- // } catch {
- // yield `${this.client.util.emojis.warn} Unable to dm user`;
- // }
- // try {
- // await user.kick(
- // `Kicked by ${message instanceof Message ? message.author.tag : message.user.tag} with ${
- // reason ? `reason ${reason}` : 'no reason'
- // }`
- // );
- // } catch {
- // yield `${this.client.util.emojis.error} Error kicking :/`;
- // await modlogEnry.destroy();
- // return;
- // }
- // yield `${this.client.util.emojis.success} Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``;
- // }
+ async exec(message: BushMessage | BushSlashMessage, { user, reason }: { user: BushUser; reason?: string }): Promise<unknown> {
+ const member = message.guild.members.cache.get(user.id) as BushGuildMember;
+ const canModerateResponse = this.client.util.moderationPermissionCheck(message.member, member, 'kick');
+ // const victimBoldTag = `**${member.user.tag}**`;
+
+ if (typeof canModerateResponse !== 'boolean') {
+ return message.util.reply(canModerateResponse);
+ }
- async exec(message: Message, { user, reason }: { user: GuildMember; reason?: string }): Promise<unknown> {
- return message.util.reply(`${this.client.util.emojis.error} This command is not finished.`);
- // for await (const response of this.genResponses(message, user, reason)) {
- // await message.util.send(response);
- // }
+ const response = await member.bushKick({
+ reason,
+ moderator: message.author
+ });
+
+
}
}