Skip to content

Commit 013190a

Browse files
committed
Improve usage command
- Fix border style - Make all arguments optional - Display usage when no arguments
1 parent 8655120 commit 013190a

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

src/bot-modules/pokemon/usage/commands.js

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,23 @@ module.exports = {
260260
return this.errorReply(this.mlt('error'));
261261
}
262262
if (!this.arg) {
263-
return this.errorReply(this.usage({ desc: 'pokemon' }, { desc: 'tier', optional: true }, { desc: 'ladder (top|high|mid|low)', optional: true }));
263+
return this.restrictReply(
264+
this.mlt('stats') + ": " + link +
265+
" | " +
266+
this.usage({ desc: 'pokemon' }, { desc: 'tier', optional: true }, { desc: 'ladder (top|high|mid|low)', optional: true }),
267+
'usage'
268+
);
264269
}
270+
271+
if (this.args.length === 1 || (this.args.length === 2 && Valid_ladder_Types.includes(getLadderType(Text.toId(this.args[1]))))) {
272+
const possibleTier = parseAliases(this.args[0], App);
273+
if (App.bot.formats[possibleTier]) {
274+
this.cmd = "usagetop";
275+
this.parser.exec(this);
276+
return;
277+
}
278+
}
279+
265280
let poke = "garchomp", searchIndex = -1;
266281
let tier = App.config.modules.pokemon.gtier || parseAliases('ou', App);
267282
let ladder = 'high';
@@ -814,16 +829,16 @@ module.exports = {
814829
let html;
815830

816831
if (canUseHtmlInRoom) {
817-
html = '<table>' +
832+
html = '<table style="border-collapse: collapse;">' +
818833
// First row
819-
'<tr><td style="text-align:center; border-right: solid 1px black; padding: 12px;"><b>' + Text.escapeHTML(dataRes.name) + '</b></td>' +
834+
'<tr><td style="text-align:center; border-right: solid 1px #7799BB; padding: 12px;"><b>' + Text.escapeHTML(dataRes.name) + '</b></td>' +
820835
'<td style="padding: 12px;">' +
821836
usageBaseLineHtml +
822837
'</td></tr>' +
823838
// Second row
824839
'<tr>' +
825840
// Image
826-
'<td style="text-align:center; border-right: solid 1px black; padding: 12px;"><img src="https://play.pokemonshowdown.com/sprites/gen5/' + toSpriteId(dataRes.name) + '.png" height="96" width="96" alt="' + Text.escapeHTML(dataRes.name) + '"></td>' +
841+
'<td style="text-align:center; border-right: solid 1px #7799BB; padding: 12px;"><img src="https://play.pokemonshowdown.com/sprites/gen5/' + toSpriteId(dataRes.name) + '.png" height="96" width="96" alt="' + Text.escapeHTML(dataRes.name) + '"></td>' +
827842
// Details
828843
'<td style="padding: 12px;">' +
829844
detailsHTML +

0 commit comments

Comments
 (0)