aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation/kick.ts
diff options
context:
space:
mode:
authorTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-28 21:54:50 -0600
committerTymanWasTaken <32660892+tymanwastaken@users.noreply.github.com>2021-05-28 21:54:50 -0600
commit2456dab3db0d8eaae515606b83a6c0c317d009b0 (patch)
treec20448112d43c1b4ffae1395584d9b202aeee3ed /src/commands/moderation/kick.ts
parent1e9e334097702c68d871365fc016aa096d03c491 (diff)
parent5b5f0bf5667b922037508dfa88e40a1f8a2671ec (diff)
downloadtanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.gz
tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.tar.bz2
tanzanite-2456dab3db0d8eaae515606b83a6c0c317d009b0.zip
fix conflicts
Diffstat (limited to 'src/commands/moderation/kick.ts')
-rw-r--r--src/commands/moderation/kick.ts40
1 files changed, 10 insertions, 30 deletions
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index f31047e..182485a 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -1,13 +1,14 @@
-import { BotCommand } from '../../lib/extensions/BotCommand';
+import { BushCommand } from '../../lib/extensions/BushCommand';
import { Guild, Modlog, ModlogType } from '../../lib/models';
import { GuildMember, Message } from 'discord.js';
import { ApplicationCommandOptionType } from 'discord-api-types';
import { CommandInteraction } from 'discord.js';
-export default class KickCommand extends BotCommand {
+export default class KickCommand extends BushCommand {
constructor() {
super('kick', {
aliases: ['kick'],
+ category: 'moderation',
args: [
{
id: 'user',
@@ -45,11 +46,7 @@ export default class KickCommand extends BotCommand {
});
}
- private async *genResponses(
- message: Message | CommandInteraction,
- user: GuildMember,
- reason?: string
- ): AsyncIterable<string> {
+ 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({
@@ -64,8 +61,7 @@ export default class KickCommand extends BotCommand {
modlogEnry = Modlog.build({
user: user.id,
guild: message.guild.id,
- moderator:
- message instanceof Message ? message.author.id : message.user.id,
+ moderator: message instanceof Message ? message.author.id : message.user.id,
type: ModlogType.KICK,
reason
});
@@ -76,43 +72,27 @@ export default class KickCommand extends BotCommand {
return;
}
try {
- await user.send(
- `You were kicked in ${message.guild.name} with reason \`${
- reason || 'No reason given'
- }\``
- );
+ await user.send(`You were kicked in ${message.guild.name} with reason \`${reason || 'No reason given'}\``);
} catch (e) {
yield 'Error sending message to user';
}
try {
- await user.kick(
- `Kicked by ${
- message instanceof Message ? message.author.tag : message.user.tag
- } with ${reason ? `reason ${reason}` : 'no reason'}`
- );
+ await user.kick(`Kicked by ${message instanceof Message ? message.author.tag : message.user.tag} with ${reason ? `reason ${reason}` : 'no reason'}`);
} catch {
yield 'Error kicking :/';
await modlogEnry.destroy();
return;
}
- yield `Kicked <@!${user.id}> with reason \`${
- reason || 'No reason given'
- }\``;
+ yield `Kicked <@!${user.id}> with reason \`${reason || 'No reason given'}\``;
}
- async exec(
- message: Message,
- { user, reason }: { user: GuildMember; reason?: string }
- ): Promise<void> {
+ async exec(message: Message, { user, reason }: { user: GuildMember; reason?: string }): Promise<void> {
for await (const response of this.genResponses(message, user, reason)) {
await message.util.send(response);
}
}
- async execSlash(
- message: CommandInteraction,
- { user, reason }: { user: GuildMember; reason?: string }
- ): Promise<void> {
+ async execSlash(message: CommandInteraction, { user, reason }: { user: GuildMember; reason?: string }): Promise<void> {
for await (const response of this.genResponses(message, user, reason)) {
await message.reply(response);
}