aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/config/config.ts26
-rw-r--r--src/commands/leveling/level.ts6
-rw-r--r--yarn.lock4
3 files changed, 18 insertions, 18 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();
diff --git a/yarn.lock b/yarn.lock
index 2afdde8..59e2c70 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1117,12 +1117,12 @@ discord-akairo-message-util@NotEnoughUpdates/discord-akairo-message-util:
discord-akairo@NotEnoughUpdates/discord-akairo:
version: 8.2.2
- resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=30de76ee857660939fff5194e40f5bb5d7332cb5"
+ resolution: "discord-akairo@https://github.com/NotEnoughUpdates/discord-akairo.git#commit=8c34349a3eb03164e34bcf538787cce259c76aa9"
dependencies:
discord-akairo-message-util: NotEnoughUpdates/discord-akairo-message-util
lodash: ^4.17.21
source-map-support: ^0.5.19
- checksum: c2cfc469240a48ef8726036d5dfcb0246e32c84fde228deebfac7ed43540ac7451403fbf880eee1335d56f3b5257584ee68c6042e2c2bc6047c176fe2ba2ca31
+ checksum: 7b71844b4955fed0f383b59e23770e526140459dc55b3a8af4707bd6be7a9295c2ac6812df47282a5b922a50f4569b597151f21f893ecce7ef9b1e8b87f88a64
languageName: node
linkType: hard