Skip to content

Commit

Permalink
🐛 Fix specific help without example output
Browse files Browse the repository at this point in the history
  • Loading branch information
totigm committed Aug 16, 2022
1 parent 4354fbe commit 24e9f3c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@totigm/bot-builder",
"version": "1.0.2",
"version": "1.0.3",
"description": "This is a library to create bots for different platforms. It handles all the commands stuff behind the scenes, so you can focus on your bot's logic.",
"main": "dist/index.js",
"bin": "dist/index.js",
Expand Down
6 changes: 3 additions & 3 deletions src/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ export default abstract class Bot<Client extends EventEmitter = EventEmitter, Bo

const exampleArgs = {
input: example?.input ? `${example.input} ` : "",
output: example.output ? `${this.boldText("->")} ${example.output}` : "",
output: example?.output ? `${this.boldText("->")} ${example.output}` : "",
};

const hasExample = Object.values(exampleArgs).some((value) => value !== "");
return hasExample
? `${this.options.botMessages.help.exampleText}: ${formattedCommand} ${exampleArgs.input}${exampleArgs.output}`
? `\n${this.options.botMessages.help.exampleText}: ${formattedCommand} ${exampleArgs.input}${exampleArgs.output}`
: "";
}

Expand All @@ -103,7 +103,7 @@ export default abstract class Bot<Client extends EventEmitter = EventEmitter, Bo
const explanationMessage = this.getExplanationMessage(commandName);
const exampleMessage = this.getExampleMessage(commandName);

return `${explanationMessage}\n${exampleMessage}`;
return `${explanationMessage}${exampleMessage}`;
}

private addHelpCommand() {
Expand Down

0 comments on commit 24e9f3c

Please sign in to comment.