Skip to content

Commit 2e733e8

Browse files
committed
[REFACTOR] merges the doc and bot command into the about command
1 parent 01a4835 commit 2e733e8

File tree

5 files changed

+41
-92
lines changed

5 files changed

+41
-92
lines changed

index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
require('dotenv').config();
22
const { Alice } = require('./src/Alice');
33
const {
4-
Bot,
4+
About,
55
Coin,
66
Commands,
77
Cron,
8-
Doc,
98
Links,
109
Lyric,
1110
Report,
@@ -15,11 +14,10 @@ const {
1514
} = require('./src/commands');
1615

1716
const alice = new Alice([
18-
new Bot(),
17+
new About(),
1918
new Coin(),
2019
new Commands(),
2120
new Cron(),
22-
new Doc(),
2321
new Links(),
2422
new Lyric(),
2523
new Report(),

src/commands/about.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const STRINGS = {
2+
help: `
3+
Mostra informações sobre o bot.
4+
5+
*uso:* \`\`\`!about [--args]\`\`\`
6+
7+
*args válidos:*
8+
\`\`\`--help\`\`\` -> _mostra esta mensagem._
9+
`.trim(),
10+
11+
about: `
12+
Alice foi criada utilizando a biblioteca \`\`\`whatsapp-web.js\`\`\` como base sob licença Apache 2.0. Saiba mais em _https://github.com/pedroslopez/whatsapp-web.js_
13+
14+
Não sabe como usar um comando? Use a flag help, ex: \`\`\`!lyric --help\`\`\`. Se não conhece os comandos, use \`\`\`!commands\`\`\`
15+
16+
_Quer contribuir? Então dá uma olhada em https://github.com/Coding-in-community/alice_
17+
`.trim(),
18+
};
19+
20+
class About {
21+
constructor() {
22+
this.name = 'about';
23+
this.strings = STRINGS;
24+
}
25+
26+
execute(data, message) {
27+
const { args } = data;
28+
29+
if (args.includes('help')) {
30+
message.reply(this.strings.help);
31+
return;
32+
}
33+
34+
message.reply(this.strings.about);
35+
}
36+
}
37+
38+
module.exports = About;

src/commands/bot.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/commands/doc.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/commands/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/* eslint-disable global-require */
22

33
module.exports = {
4-
Bot: require('./bot'),
4+
About: require('./about'),
55
Coin: require('./coin'),
66
Commands: require('./commands'),
77
Cron: require('./cron'),
8-
Doc: require('./doc'),
98
Links: require('./links'),
109
Lyric: require('./lyric'),
1110
Report: require('./report'),

0 commit comments

Comments
 (0)