aboutsummaryrefslogtreecommitdiff
path: root/src/commands/moderation
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-05-28 17:37:04 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-05-28 17:37:04 -0400
commitf1cdbd260c6c2249fc0d765949d44d889bcaedc8 (patch)
treea91883fc6de76d739f99c795f1248474df6f1efc /src/commands/moderation
parentf3cde793e778d1dc29b704d9cce560c6e929e6e8 (diff)
downloadtanzanite-f1cdbd260c6c2249fc0d765949d44d889bcaedc8.tar.gz
tanzanite-f1cdbd260c6c2249fc0d765949d44d889bcaedc8.tar.bz2
tanzanite-f1cdbd260c6c2249fc0d765949d44d889bcaedc8.zip
I can't read anything
Diffstat (limited to 'src/commands/moderation')
-rw-r--r--src/commands/moderation/ban.ts40
-rw-r--r--src/commands/moderation/kick.ts17
-rw-r--r--src/commands/moderation/modlog.ts19
-rw-r--r--src/commands/moderation/role.ts21
-rw-r--r--src/commands/moderation/warn.ts12
5 files changed, 26 insertions, 83 deletions
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index feb020b..05c26e0 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -45,13 +45,9 @@ export default class BanCommand extends BushCommand {
clientPermissions: ['BAN_MEMBERS'],
userPermissions: ['BAN_MEMBERS'],
description: {
- content:
- 'Ban a member and log it in modlogs (with optional time to unban)',
+ content: 'Ban a member and log it in modlogs (with optional time to unban)',
usage: 'ban <member> <reason> [--time]',
- examples: [
- 'ban @Tyman being cool',
- 'ban @Tyman being cool --time 7days'
- ]
+ examples: ['ban @Tyman being cool', 'ban @Tyman being cool --time 7days']
},
slashCommandOptions: [
{
@@ -69,8 +65,7 @@ export default class BanCommand extends BushCommand {
{
type: ApplicationCommandOptionType.STRING,
name: 'time',
- description:
- 'The time the user should be banned for (default permanent)',
+ description: 'The time the user should be banned for (default permanent)',
required: false
}
]
@@ -119,10 +114,7 @@ export default class BanCommand extends BushCommand {
reason,
type: ModlogType.TEMPBAN,
duration: duration.asMilliseconds(),
- moderator:
- message instanceof CommandInteraction
- ? message.user.id
- : message.author.id
+ moderator: message instanceof CommandInteraction ? message.user.id : message.author.id
});
banEntry = Ban.build({
user: user.id,
@@ -137,10 +129,7 @@ export default class BanCommand extends BushCommand {
guild: message.guild.id,
reason,
type: ModlogType.BAN,
- moderator:
- message instanceof CommandInteraction
- ? message.user.id
- : message.author.id
+ moderator: message instanceof CommandInteraction ? message.user.id : message.author.id
});
banEntry = Ban.build({
user: user.id,
@@ -159,9 +148,7 @@ export default class BanCommand extends BushCommand {
try {
await user.send(
`You were banned in ${message.guild.name} ${
- translatedTime.length >= 1
- ? `for ${translatedTime.join(', ')}`
- : 'permanently'
+ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently'
} with reason \`${reason || 'No reason given'}\``
);
} catch (e) {
@@ -169,15 +156,11 @@ export default class BanCommand extends BushCommand {
}
await message.guild.members.ban(user, {
reason: `Banned by ${
- message instanceof CommandInteraction
- ? message.user.tag
- : message.author.tag
+ message instanceof CommandInteraction ? message.user.tag : message.author.tag
} with ${reason ? `reason ${reason}` : 'no reason'}`
});
yield `Banned <@!${user.id}> ${
- translatedTime.length >= 1
- ? `for ${translatedTime.join(', ')}`
- : 'permanently'
+ translatedTime.length >= 1 ? `for ${translatedTime.join(', ')}` : 'permanently'
} with reason \`${reason || 'No reason given'}\``;
} catch {
yield 'Error banning :/';
@@ -190,12 +173,7 @@ export default class BanCommand extends BushCommand {
message: Message,
{ user, reason, time }: { user: User; reason?: string; time?: string }
): Promise<void> {
- for await (const response of this.genResponses(
- message,
- user,
- reason,
- time
- )) {
+ for await (const response of this.genResponses(message, user, reason, time)) {
await message.util.send(response);
}
}
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index 58cf52e..f3ee44c 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -65,8 +65,7 @@ export default class KickCommand extends BushCommand {
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
});
@@ -78,27 +77,23 @@ export default class KickCommand extends BushCommand {
}
try {
await user.send(
- `You were kicked in ${message.guild.name} with reason \`${
- reason || 'No reason given'
- }\``
+ `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'}`
+ `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(
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index 2df4745..c4eb46a 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -53,10 +53,7 @@ export default class ModlogCommand extends BushCommand {
return { search, page };
}
}
- async exec(
- message: Message,
- { search, page }: { search: string; page: number }
- ): Promise<void> {
+ async exec(message: Message, { search, page }: { search: string; page: number }): Promise<void> {
const foundUser = await this.client.util.resolveUserAsync(search);
if (foundUser) {
const logs = await Modlog.findAll({
@@ -73,11 +70,7 @@ export default class ModlogCommand extends BushCommand {
Type: ${log.type.toLowerCase()}
User: <@!${log.user}> (${log.user})
Moderator: <@!${log.moderator}> (${log.moderator})
- Duration: ${
- log.duration
- ? moment.duration(log.duration, 'milliseconds').humanize()
- : 'N/A'
- }
+ Duration: ${log.duration ? moment.duration(log.duration, 'milliseconds').humanize() : 'N/A'}
Reason: ${log.reason || 'None given'}
${this.client.util.ordinal(logs.indexOf(log) + 1)} action
`);
@@ -87,9 +80,7 @@ export default class ModlogCommand extends BushCommand {
(e, i) =>
new MessageEmbed({
title: `Modlogs page ${i + 1}`,
- description: e.join(
- '\n-------------------------------------------------------\n'
- ),
+ description: e.join('\n-------------------------------------------------------\n'),
footer: {
text: `Page ${i + 1}/${chunked.length}`
}
@@ -120,9 +111,7 @@ export default class ModlogCommand extends BushCommand {
{
name: 'Duration',
value: `${
- entry.duration
- ? moment.duration(entry.duration, 'milliseconds').humanize()
- : 'N/A'
+ entry.duration ? moment.duration(entry.duration, 'milliseconds').humanize() : 'N/A'
}`,
inline: true
},
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index d5948c3..f03e0ad 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -22,13 +22,7 @@ export default class RoleCommand extends BushCommand {
'No Links': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'No Bots': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'No VC': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
- 'No Giveaways': [
- '*',
- 'Admin Perms',
- 'Sr. Moderator',
- 'Moderator',
- 'Helper'
- ],
+ 'No Giveaways': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator', 'Helper'],
'No Support': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'Giveaway Donor': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
'Giveaway (200m)': ['*', 'Admin Perms', 'Sr. Moderator', 'Moderator'],
@@ -95,9 +89,7 @@ export default class RoleCommand extends BushCommand {
!message.member.permissions.has('MANAGE_ROLES') &&
!this.client.ownerID.includes(message.author.id)
) {
- const mappedRole = this.client.util.moulberryBushRoleMap.find(
- (m) => m.id === role.id
- );
+ const mappedRole = this.client.util.moulberryBushRoleMap.find((m) => m.id === role.id);
if (!mappedRole || !this.roleWhitelist[mappedRole.name]) {
return message.util.reply(
`<:error:837123021016924261> <@&${role.id}> is not whitelisted, and you do not have manage roles permission.`,
@@ -107,14 +99,9 @@ export default class RoleCommand extends BushCommand {
);
}
const allowedRoles = this.roleWhitelist[mappedRole.name].map((r) => {
- return this.client.util.moulberryBushRoleMap.find((m) => m.name === r)
- .id;
+ return this.client.util.moulberryBushRoleMap.find((m) => m.name === r).id;
});
- if (
- !message.member.roles.cache.some((role) =>
- allowedRoles.includes(role.id)
- )
- ) {
+ if (!message.member.roles.cache.some((role) => allowedRoles.includes(role.id))) {
return message.util.reply(
`<:error:837123021016924261> <@&${role.id}> is whitelisted, but you do not have any of the roles required to manage it.`,
{
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index a61eef3..5651830 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -48,21 +48,15 @@ export default class WarnCommand extends BushCommand {
});
await entry.save();
} catch (e) {
- await message.util.send(
- 'Error saving to database, please contact the developers'
- );
+ await message.util.send('Error saving to database, please contact the developers');
return;
}
try {
- await member.send(
- `You were warned in ${message.guild.name} for reason "${reason}".`
- );
+ await member.send(`You were warned in ${message.guild.name} for reason "${reason}".`);
} catch (e) {
await message.util.send('Error messaging user, warning still saved.');
return;
}
- await message.util.send(
- `${member.user.tag} was warned for reason "${reason}".`
- );
+ await message.util.send(`${member.user.tag} was warned for reason "${reason}".`);
}
}