Skip to content

Commit 135f95c

Browse files
committed
[FIX] resolves eslint errors
1 parent 4f99035 commit 135f95c

25 files changed

+348
-371
lines changed

alice/index.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
// imports
2-
let src = require('./src');
3-
let build = require('./src/build');
2+
const src = require('./src');
3+
const build = require('./src/build');
44

55
// instance
6-
let path = new build.Path(__dirname);
6+
const path = new build.Path(__dirname);
77

8-
let alice = new src.Alice([
9-
path.create('scripts/bot', (alias = 'bot')),
10-
path.create('scripts/coin', (alias = 'coin')),
11-
path.create('scripts/commands', (alias = 'commands')),
12-
path.create('scripts/cron', (alias = 'cron')),
13-
path.create('scripts/dice', (alias = 'dice')),
14-
path.create('scripts/doc', (alias = 'doc')),
15-
path.create('scripts/doc', (alias = 'help')),
16-
path.create('scripts/github', (alias = 'github')),
17-
path.create('scripts/links', (alias = 'links')),
18-
path.create('scripts/lyric', (alias = 'lyric')),
19-
path.create('scripts/report', (alias = 'report')),
20-
path.create('scripts/search', (alias = 'search')),
21-
path.create('scripts/suggest', (alias = 'suggest')),
22-
path.create('scripts/wiki', (alias = 'wiki')),
8+
const alice = new src.Alice([
9+
path.create('scripts/bot', 'bot'),
10+
path.create('scripts/coin', 'coin'),
11+
path.create('scripts/commands', 'commands'),
12+
path.create('scripts/cron', 'cron'),
13+
path.create('scripts/dice', 'dice'),
14+
path.create('scripts/doc', 'doc'),
15+
path.create('scripts/doc', 'help'),
16+
path.create('scripts/github', 'github'),
17+
path.create('scripts/links', 'links'),
18+
path.create('scripts/lyric', 'lyric'),
19+
path.create('scripts/report', 'report'),
20+
path.create('scripts/search', 'search'),
21+
path.create('scripts/suggest', 'suggest'),
22+
path.create('scripts/wiki', 'wiki'),
2323
]);
2424

2525
alice.initialize();

alice/scripts/bot.js

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

alice/scripts/coin.js

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ const cheerio = require('cheerio');
33

44
async function loadCheerio(url) {
55
try {
6-
let response = await axios.get(url);
7-
let html = response.data;
6+
const response = await axios.get(url);
7+
const html = response.data;
88

99
return cheerio.load(html);
1010
} catch (err) {
@@ -15,33 +15,32 @@ async function loadCheerio(url) {
1515
}
1616

1717
async function getData(url) {
18-
let $ = await loadCheerio(url);
18+
const $ = await loadCheerio(url);
1919
if (typeof $ === 'function') {
20-
let priceStatistics = $('.sc-AxhCb.gsRRvB.container___E9axz');
21-
let priceStatisticsTable = priceStatistics.find('table');
22-
let priceStatisticsTableBody = priceStatisticsTable.find('tbody');
23-
let priceStatisticsTableRow = priceStatisticsTableBody.find('tr');
20+
const priceStatistics = $('.sc-AxhCb.gsRRvB.container___E9axz');
21+
const priceStatisticsTable = priceStatistics.find('table');
22+
const priceStatisticsTableBody = priceStatisticsTable.find('tbody');
23+
const priceStatisticsTableRow = priceStatisticsTableBody.find('tr');
2424

25-
let data = [];
25+
const data = [];
2626
priceStatisticsTableRow.each(function () {
27-
let elem = $(this);
27+
const elem = $(this);
2828

29-
let key = elem.find('th').text();
29+
const key = elem.find('th').text();
3030

3131
let value = elem.find('td');
3232
if (value.find('span.sc-1v2ivon-0.gClTFY').text()) {
33-
value =
34-
value.find('span').first().text() +
35-
' || ' +
36-
value.find('span.sc-1v2ivon-0.gClTFY').text();
33+
value = `${value.find('span').first().text()} || ${value
34+
.find('span.sc-1v2ivon-0.gClTFY')
35+
.text()}`;
3736
} else {
3837
value = value.text();
3938
}
4039

4140
console.log(value);
4241

4342
if (value !== 'No Data' || value !== 'Sem Dados') {
44-
let object = Object.fromEntries([[key, value]]);
43+
const object = Object.fromEntries([[key, value]]);
4544
data.push(object);
4645
}
4746
});
@@ -52,41 +51,39 @@ async function getData(url) {
5251
return null;
5352
}
5453

55-
let _default = `
54+
const defaultMessage = `
5655
uso: *!coin* [--flag] name
5756
_--all -> mostra todas as informações disponiveis_
5857
5958
a flag _all_ pode retornar dados em excesso, sua utilização repetida será considera spam
6059
`;
6160

62-
module.exports = async function (data) {
61+
module.exports = async (data) => {
6362
let BASE_URL = 'https://coinmarketcap.com/currencies/';
6463

6564
if (data.args.includes('brl')) {
6665
BASE_URL = 'https://coinmarketcap.com/pt-br/currencies/';
6766
}
6867

6968
if (data.text) {
70-
let text = data.text.replace(/\s/g, '-').toLowerCase();
71-
let url = BASE_URL + text;
69+
const text = data.text.replace(/\s/g, '-').toLowerCase();
70+
const url = BASE_URL + text;
7271
let coinData = await getData(url);
7372

7473
if (coinData) {
7574
if (!data.args.includes('all')) coinData = coinData.slice(0, 3);
7675

7776
let coinDataString = '';
7877
coinData.forEach((elem) => {
79-
let [key, value] = Object.entries(elem)[0];
78+
const [key, value] = Object.entries(elem)[0];
8079

81-
let string = `*_${key}_*:\n - ${value}\n\n`;
80+
const string = `*_${key}_*:\n - ${value}\n\n`;
8281
coinDataString += string;
8382
});
8483

8584
return coinDataString.trim();
86-
} else {
87-
return 'moeda não encontrada';
8885
}
89-
} else {
90-
return _default.trim();
86+
return 'moeda não encontrada';
9187
}
88+
return defaultMessage.trim();
9289
};

alice/scripts/commands.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module.exports = function () {
2-
let string_output = `
1+
module.exports = () => {
2+
const stringOutput = `
33
Os seguintes comandos estão disponiveis:
44
- !bot
55
- !commands
@@ -15,5 +15,5 @@ module.exports = function () {
1515
- !wiki
1616
`;
1717

18-
return string_output.trim();
18+
return stringOutput.trim();
1919
};

0 commit comments

Comments
 (0)