diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-06-24 00:56:16 -0400 |
commit | 4176b6258e44e4a095376aaf0f4c687244243a69 (patch) | |
tree | 3b9144be9a2045483c90d92fff05b3ca0b288e52 /src/commands/config/muteRole.ts | |
parent | e80446e23060c0325bbd6db620920d86694ec3ce (diff) | |
download | tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.gz tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.tar.bz2 tanzanite-4176b6258e44e4a095376aaf0f4c687244243a69.zip |
feat(*): Began working on other punishment commands etc
Diffstat (limited to 'src/commands/config/muteRole.ts')
-rw-r--r-- | src/commands/config/muteRole.ts | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/commands/config/muteRole.ts b/src/commands/config/muteRole.ts new file mode 100644 index 0000000..f51c5ce --- /dev/null +++ b/src/commands/config/muteRole.ts @@ -0,0 +1,57 @@ +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 AllowedMentions from '../../lib/utils/AllowedMentions'; + +export default class MuteRoleCommand extends BushCommand { + constructor() { + super('muteRole', { + aliases: ['muterole'], + category: 'config', + description: { + content: 'Set the prefix of the current server (resets to default if prefix is not given)', + usage: 'prefix [prefix]', + examples: ['prefix', 'prefix +'] + }, + clientPermissions: ['SEND_MESSAGES'], + userPermissions: ['SEND_MESSAGES', 'MANAGE_GUILD'], + args: [ + { + id: 'role', + type: 'role', + prompt: { + start: "What would you like to set the server's mute role to?", + retry: '{error} Choose a valid role.', + optional: false + } + } + ], + slash: true, + slashOptions: [ + { + type: 'ROLE', + name: 'role', + description: 'The mute role for this server.', + required: true + } + ] + }); + } + + 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.util.send({ + content: `${this.client.util.emojis.success} Changed the mute role to <@&${args.role.id}>.`, + allowedMentions: AllowedMentions.none() + }); + } +} |