aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/config/config.ts26
-rw-r--r--src/commands/leveling/level.ts6
2 files changed, 16 insertions, 16 deletions
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 2a17883..df650fe 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -170,11 +170,11 @@ export default class SettingsCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- [x in GuildSettings | ('view' | 'set' | 'add' | 'remove') | ('setting' | 'action') | 'value']:
- | string
- | undefined
- | Channel
- | Role;
+ setting?: GuildSettings;
+ subcommandGroup?: GuildSettings;
+ action?: 'view' | 'add' | 'remove' | 'set';
+ subcommand?: 'view' | 'add' | 'remove' | 'set';
+ value: string | Channel | Role;
}
): Promise<unknown> {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
@@ -182,14 +182,14 @@ export default class SettingsCommand extends BushCommand {
return await message.util.reply(
`${util.emojis.error} You must have the **MANAGE_GUILD** permissions to run this command.`
);
- const setting = _.camelCase(args[settingsArr.find((s) => args[s]) ?? 'setting'] as string | undefined) as
- | GuildSettings
- | undefined;
- const action = (args[
- (['view', 'set', 'add', 'remove'] as ('view' | 'set' | 'add' | 'remove')[]).find((a) => args[a]) ?? 'action'
- ] ?? 'view') as 'view' | 'set' | 'add' | 'remove';
+ const setting = message.util.isSlash ? (_.camelCase(args.subcommandGroup)! as GuildSettings) : args.setting!;
+ const action = message.util.isSlash ? args.subcommand! : args.action!;
const value = args.value;
+ client.console.debug(setting);
+ client.console.debug(action);
+ client.console.debug(value);
+
let msg;
if (!setting || action === 'view') {
@@ -219,13 +219,13 @@ export default class SettingsCommand extends BushCommand {
const existing = (await message.guild.getSetting(setting)) as string[];
const updated = util.addOrRemoveFromArray('add', existing, parseVal(value));
await message.guild.setSetting(setting, updated);
- const messageOptions = await this.generateMessageOptions(message);
+ const messageOptions = await this.generateMessageOptions(message, setting);
msg = (await message.util.reply(messageOptions)) as Message;
break;
}
case 'set': {
await message.guild.setSetting(setting, parseVal(value));
- const messageOptions = await this.generateMessageOptions(message);
+ const messageOptions = await this.generateMessageOptions(message, setting);
msg = (await message.util.reply(messageOptions)) as Message;
break;
}
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index a579df0..35a0a3e 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -58,7 +58,7 @@ export default class LevelCommand extends BushCommand {
const xpForNextLevel = Level.convertLevelToXp(userLevelRow.level + 1) - currentLevelXP;
const white = '#FFFFFF',
gray = '#23272A',
- newBlurple = '#5865F2';
+ highlight = user.hexAccentColor ?? '#5865F2';
// Load roboto font because yes
canvas.registerFont(join(__dirname, '..', '..', '..', '..', 'lib', 'assets', 'Roboto-Regular.ttf'), {
family: 'Roboto'
@@ -83,7 +83,7 @@ export default class LevelCommand extends BushCommand {
const measuredTag = ctx.measureText(user.tag);
ctx.fillText(user.tag, avatarImage.width + 70, 60);
// Draw line under tag
- ctx.fillStyle = newBlurple;
+ ctx.fillStyle = highlight;
ctx.fillRect(avatarImage.width + 70, 65 + measuredTag.actualBoundingBoxDescent, measuredTag.width, 3);
// Draw leveling bar
const fullProgressBar = new CanvasProgressBar(
@@ -106,7 +106,7 @@ export default class LevelCommand extends BushCommand {
height: 30,
width: 550
},
- newBlurple,
+ highlight,
currentLevelXPProgress / xpForNextLevel
);
progressBar.draw();