Skip to content

Commit

Permalink
Fixed help color (base 10, base 16 support)
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaaz committed May 6, 2019
1 parent 3396168 commit 89f655b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion example/src/configs/templateConf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"embed": {
"colors": {
"help": "",
"help": "ffffff",
"global": 4315874,
"error": 15844367
}
Expand Down
6 changes: 3 additions & 3 deletions src/AxonClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,9 +736,9 @@ class AxonClient extends EventEmitter {
text: 'Runs with AxonCore',
};

// eslint-disable-next-line no-nested-ternary
embed.color = isNaN(this.template.embed.colors.help)
? this.template.embed.colors.help.length > 0 ? parseInt(this.template.embed.colors.help, 10) : null

embed.color = typeof this.template.embed.colors.help === 'string'
? parseInt(this.template.embed.colors.help, 16) || null
: this.template.embed.colors.help;

let commandList = '';
Expand Down
5 changes: 2 additions & 3 deletions src/Structures/Command.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,8 @@ class Command extends Base {
icon_url: this.bot.user.avatarURL,
};

// eslint-disable-next-line no-nested-ternary
embed.color = isNaN(this.template.embed.colors.help)
? this.template.embed.colors.help.length > 0 ? parseInt(this.template.embed.colors.help, 10) : null
embed.color = typeof this.template.embed.colors.help === 'string'
? parseInt(this.template.embed.colors.help, 16) || null
: this.template.embed.colors.help;

embed.description = `**Description:** ${this.infos.description}\n`;
Expand Down

0 comments on commit 89f655b

Please sign in to comment.