-
Notifications
You must be signed in to change notification settings - Fork 0
/
username.js
29 lines (25 loc) · 934 Bytes
/
username.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const async = require('async');
const fs = require('fs');
const path = require('path');
const twitch = require('./src/managers/twitch');
// const MediumWordsFilePath = path.resolve(__dirname, 'src/util/medium-words.txt');
const PrefixSuffixFilePath = path.resolve(__dirname, 'src/util/prefix-suffix-list.txt');
// const ShortWordsFilePath = path.resolve(__dirname, 'src/util/short-words.txt');
async function main() {
const prefixSuffixList = await (await fs.promises.readFile(PrefixSuffixFilePath, 'utf8')).split('\n').filter((line, i) => {
if (i === 0) {
return 0;
}
return !!line;
}).map((line, i) => {
return line.split('\t')[2];
});
await async.eachSeries(prefixSuffixList, async (prefixSuffix) => {
const replace = prefixSuffix.replace('+', 'sarah');
const user = await twitch.getUserByName(replace);
if (!user) {
console.log(`${replace} is available`);
}
});
}
main();