-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
executable file
·46 lines (40 loc) · 1.2 KB
/
index.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env node
const cli = require("commander");
const utils = require("./src/utils");
const SoundsBot = require("./src/bot");
cli
.version("0.1.0")
.option("-t, --token <token>", "Discord bot token.")
.option("-i, --client-id <client-id>", "Discord bot client ID.")
.option(
"-s, --sounds <path>",
"Path to sounds folder.",
utils.pathExists("sounds")
)
.option(
"-a, --add-allowed-users [users]",
"Comma separated list of discord users allowed to add sounds.",
utils.strToList,
[]
)
.option(
"-d, --delete-allowed-users [users]",
"Comma separated list of discord users allowed to delete sounds.",
utils.strToList,
[]
)
.option(
"-c, --config [path]",
"Path to config. Provided flags override config ones.",
utils.parseConfig,
{}
)
.parse(process.argv);
const config = utils.validateConfig(utils.mergeCliWithConfig(cli, cli.config));
const bot = new SoundsBot(config);
bot.start();
const message = [
"Use the following URL to let the bot join your server!",
`https://discord.com/api/oauth2/authorize?client_id=${config.clientId}&permissions=3220480&scope=bot`,
].join("\n");
console.log(message); // eslint-disable-line no-console