aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config/muteRole.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-27 18:08:14 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-06-27 18:08:14 -0400
commit747b3c8302245699294b671d19b3d31d63f80bc1 (patch)
treead3d987bb38d5bdaed67e6aca1263fb06331f746 /src/commands/config/muteRole.ts
parent4176b6258e44e4a095376aaf0f4c687244243a69 (diff)
downloadtanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.tar.gz
tanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.tar.bz2
tanzanite-747b3c8302245699294b671d19b3d31d63f80bc1.zip
did this a while ago so I don't remeber what I did
Diffstat (limited to 'src/commands/config/muteRole.ts')
-rw-r--r--src/commands/config/muteRole.ts21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts
index f51c5ce..a354bcc 100644
--- a/src/commands/config/muteRole.ts
+++ b/src/commands/config/muteRole.ts
@@ -1,8 +1,8 @@
+import { ApplicationCommandOptionType } from 'discord-api-types';
import { Role } from 'discord.js';
import { BushCommand } from '../../lib/extensions/BushCommand';
-import { BushSlashMessage } from '../../lib/extensions/BushInteractionMessage';
import { BushMessage } from '../../lib/extensions/BushMessage';
-import { Guild } from '../../lib/models';
+import { BushSlashMessage } from '../../lib/extensions/BushSlashMessage';
import AllowedMentions from '../../lib/utils/AllowedMentions';
export default class MuteRoleCommand extends BushCommand {
@@ -11,7 +11,7 @@ export default class MuteRoleCommand extends BushCommand {
aliases: ['muterole'],
category: 'config',
description: {
- content: 'Set the prefix of the current server (resets to default if prefix is not given)',
+ content: 'Configure what role to use when muting users.',
usage: 'prefix [prefix]',
examples: ['prefix', 'prefix +']
},
@@ -31,9 +31,9 @@ export default class MuteRoleCommand extends BushCommand {
slash: true,
slashOptions: [
{
- type: 'ROLE',
+ type: ApplicationCommandOptionType.ROLE,
name: 'role',
- description: 'The mute role for this server.',
+ description: "What would you like to set the server's mute role to?",
required: true
}
]
@@ -41,16 +41,9 @@ export default class MuteRoleCommand extends BushCommand {
}
async exec(message: BushMessage | BushSlashMessage, args: { role: Role }): Promise<void> {
- let row = await Guild.findByPk(message.guild.id);
- if (!row) {
- row = Guild.build({
- id: message.guild.id
- });
- }
- row.muteRole = args.role.id;
- await row.save();
+ await message.guild.setSetting('muteRole', args.role.id);
await message.util.send({
- content: `${this.client.util.emojis.success} Changed the mute role to <@&${args.role.id}>.`,
+ content: `${this.client.util.emojis.success} Changed the server's mute role to <@&${args.role.id}>.`,
allowedMentions: AllowedMentions.none()
});
}