Skip to content

Commit 4f227af

Browse files
authored
Merge pull request #2 from BenjammingKirby/master
Make the PR compatible for v13
2 parents 2d21a9e + 8b1c675 commit 4f227af

25 files changed

+7039
-2762
lines changed

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.eslintrc.json

Lines changed: 40 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,44 @@
11
{
2-
"root": true,
3-
"parser": "@typescript-eslint/parser",
4-
"parserOptions": {},
5-
"plugins": ["@typescript-eslint", "prettier"],
6-
"extends": ["eslint:recommended", "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", "prettier"],
7-
"rules": {
8-
"prettier/prettier": [
9-
"error",
10-
{
11-
"endOfLine": "auto"
12-
},
13-
{
14-
"singleQuote": true,
15-
"parser": "flow"
16-
}
2+
"env": {
3+
"commonjs": true,
4+
"es2021": true,
5+
"node": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/recommended"
1710
],
18-
"no-console": "warn",
19-
"eol-last": "error",
20-
"object-curly-spacing": "error",
21-
"array-bracket-spacing": "error",
22-
"block-spacing": "error"
23-
},
24-
"space-in-parens": [
25-
"error",
26-
"always",
27-
{
28-
"exceptions": ["{}"]
29-
}
30-
],
31-
"no-multiple-empty-lines": [
32-
"error",
33-
{
34-
"max": 2,
35-
"maxEOF": 1
36-
}
37-
],
38-
"max-len": [
39-
"error",
40-
{
41-
"ignoreStrings": true,
42-
"ignoreTemplateLiterals": true
11+
"parser": "@typescript-eslint/parser",
12+
"parserOptions": {
13+
"ecmaVersion": 12
14+
},
15+
"plugins": [
16+
"@typescript-eslint"
17+
],
18+
"rules": {
19+
"indent": [
20+
"error",
21+
4
22+
],
23+
"linebreak-style": [
24+
"error",
25+
"unix"
26+
],
27+
"quotes": [
28+
"error",
29+
"double"
30+
],
31+
"semi": [
32+
"error",
33+
"always"
34+
],
35+
"strict" :"error",
36+
"no-var":"error",
37+
"no-console": ["warn", {"allow": ["info", "error", "warn"]}],
38+
"array-callback-return":"error",
39+
"yoda":"error",
40+
"@typescript-eslint/no-unused-vars": ["error", {"varsIgnorePattern": "^_", "argsIgnorePattern": "^_"}],
41+
"@typescript-eslint/ban-ts-comment": "off",
42+
"@typescript-eslint/no-non-null-assertion": "off"
4343
}
44-
]
4544
}

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"tabWidth": 4,
3+
"useTabs": false,
4+
"endOfLine": "lf",
5+
"semi": true,
6+
"singleQuote": false,
7+
"arrowParens": "always",
8+
"trailingComma": "all",
9+
"bracketSpacing": true,
10+
"printWidth": 120,
11+
"proseWrap": "always",
12+
"embeddedLanguageFormatting": "auto"
13+
}

README.md

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,44 @@
22

33
A Discord bot to display documentation
44

5+
## Currently supported docs
6+
7+
* discord.js (includes main/stable branch, includes djs-voice, djs-builders and djs-collection documentations)
8+
59
## Docker
610

711
To build and run the Docker container locally:
812

913
```console
10-
$ docker build . -t tphdocsbot:latest
11-
$ docker run -e TOKEN=<your discord token> tphdocsbot:latest
14+
docker build . -t tphdocsbot:latest
15+
```
16+
17+
```console
18+
docker run -e TOKEN=<your discord token> -e APPLICATIONID=<ApplicationID> -e GUILDID=<GuildID> tphdocsbot:latest
1219
```
1320

1421
### Cofiguration
1522

16-
* `TOKEN` [required] the Discord bot token to run under
17-
* `PREFIX` [required] the prefix to use for the bot
23+
* `TOKEN` [required] the Discord bot token to run under
24+
* `APPLICATIONID` [required] the Discord bot's application ID. Get it from [Dev portal](https://discord.com/developers/applications) -> your bot -> General Information -> Application ID
25+
* `GUILDID` (required to register on a specific guild) the guild id to register commands on, recommended to register on a specific guild for testing
1826

27+
### Registering
28+
29+
In order to register the commands globally, run
30+
31+
```console
32+
npm run register-global-commands
33+
```
34+
35+
For registering guild-specific commands (Recommended for testing)
36+
37+
```console
38+
npm run register-guild-commands
39+
```
40+
41+
Afterwards to reset guild commands, (To avoid duplication of global and guild-specific commands)
42+
43+
```console
44+
npm run reset-guild-commands
45+
```

dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
FROM node:14.15.3-alpine3.12
1+
FROM node:17-alpine3.12
2+
RUN apk add --update git
23
WORKDIR /usr/app
34
COPY package*.json ./
45
RUN npm install
56
COPY . .
67
RUN npm run tsc
7-
WORKDIR ./dist
8-
CMD node bot.js
8+
WORKDIR /usr/app/dist
9+
CMD npm run register-global-commands ; node bot.js

dotenv_sample

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,8 @@
1-
TOKEN = ENTER_BOT_TOKEN_HERE
2-
PREFIX = >
1+
# Your bot's token
2+
TOKEN=ENTER_BOT_TOKEN_HERE
3+
4+
# The bot's application id, get it from https://discord.com/developers/applications -> your bot -> General Information -> Application ID
5+
APPLICATIONID=1234567890123456789
6+
7+
# The ID of the guild on which the commands will be registered to (if the commands are being registered on a guild)
8+
GUILDID=1234567890123456789

0 commit comments

Comments
 (0)