aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/config/disable.ts3
-rw-r--r--src/lib/extensions/discord-akairo/BushClientUtil.ts4
-rw-r--r--src/lib/extensions/discord.js/BushGuildMember.ts3
3 files changed, 7 insertions, 3 deletions
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index ed9bf7d..00d2561 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -1,4 +1,5 @@
import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, Global } from '@lib';
+import { Argument } from 'discord-akairo';
export default class DisableCommand extends BushCommand {
public constructor() {
@@ -13,7 +14,7 @@ export default class DisableCommand extends BushCommand {
args: [
{
id: 'command',
- type: 'commandAlias',
+ type: Argument.union('commandAlias', 'command'),
match: 'phrase',
prompt: {
start: 'What command would you like to enable/disable?',
diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts
index 46e81df..9ccce65 100644
--- a/src/lib/extensions/discord-akairo/BushClientUtil.ts
+++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts
@@ -669,13 +669,15 @@ export class BushClientUtil extends ClientUtil {
duration: number;
guild: BushGuildResolvable;
modlog: string;
+ role?: Snowflake
}): Promise<Mute | Ban | PunishmentRole> {
const dbModel = this.findPunishmentModel(options.type);
const expires = options.duration ? new Date(new Date().getTime() + options.duration) : null;
const user = this.client.users.resolveId(options.user);
const guild = this.client.guilds.resolveId(options.guild);
- const entry = dbModel.build({ user, guild, expires, modlog: options.modlog });
+
+ const entry = options.type === 'role' ? (dbModel as typeof PunishmentRole).build({ user, guild, expires, modlog: options.modlog, role: options.role }):dbModel.build({ user, guild, expires, modlog: options.modlog });
return await entry.save().catch((e) => {
this.client.console.error('createPunishmentEntry', e?.stack || e);
return null;
diff --git a/src/lib/extensions/discord.js/BushGuildMember.ts b/src/lib/extensions/discord.js/BushGuildMember.ts
index fb85d7f..40e4a3a 100644
--- a/src/lib/extensions/discord.js/BushGuildMember.ts
+++ b/src/lib/extensions/discord.js/BushGuildMember.ts
@@ -136,7 +136,8 @@ export class BushGuildMember extends GuildMember {
user: this,
guild: this.guild,
duration: options.duration,
- modlog: modlog.id
+ modlog: modlog.id,
+ role: options.role.id
})
.catch(() => null);
if (!punishmentEntrySuccess) return 'error creating role entry';