Skip to content

Commit

Permalink
πŸ‘·β€β™‚οΈ Rewrite the bot to use slash commands (#26)
Browse files Browse the repository at this point in the history
* πŸ”₯ Remove webhook functionality

* 🚧 Reimplement commands

* πŸ”₯ Remove unnecessary dependencies

* πŸ“ Update README

* ⬇ Downgrade mysql2 to fix build error.

See sidorares/node-mysql2#1722

* Remove 14.x node support

* πŸ› Update pm2 ecosystem

* πŸ” Replace tslint with eslint

* πŸ› Ensure clean works on first attempt

* ⬆ Increase node version on CircleCI

* πŸ“š Improve command architecture

* πŸ’„ Finalize linted code

* πŸ”₯ Remove ts-clean in favour of --clean flag in tsc

* πŸ› Work in progress to fix running

* πŸ› Fix all newly introduced bugs based on testing

* Add members and messages intents to client

* Update node image
  • Loading branch information
tomrijnbeek authored Mar 13, 2023
1 parent 20973af commit d784f83
Show file tree
Hide file tree
Showing 43 changed files with 2,610 additions and 6,305 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
checkout:
docker:
- image: circleci/node:12
- image: cimg/node:lts
working_directory: ~/repo
steps:
- checkout
Expand All @@ -18,7 +18,7 @@ jobs:

build:
docker:
- image: circleci/node:12
- image: cimg/node:lts
working_directory: ~/repo
steps:
- checkout
Expand All @@ -29,7 +29,7 @@ jobs:

lint:
docker:
- image: circleci/node:12
- image: cimg/node:lts
working_directory: ~/repo
steps:
- checkout
Expand All @@ -40,7 +40,7 @@ jobs:

deploy:
docker:
- image: circleci/node:12
- image: cimg/node:lts
working_directory: ~/repo
steps:
- checkout
Expand Down
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
],
plugins: ['@typescript-eslint'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: true,
tsconfigRootDir: __dirname,
},
root: true,
};
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build:
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [16.x, 18.x]
uses: ./.github/workflows/build.yml
with:
node-version: ${{ matrix.node-version }}
17 changes: 4 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ QuestBot is a Discord bot based on [discord.js](https://discord.js.org/) built t

## Run the bot

To run this bot, you need to have [Node.js](https://nodejs.org/en/) 12.0.0+ installed. Once you have cloned the repository you should first install the dependencies:
To run this bot, you need to have [Node.js](https://nodejs.org/en/) 16.9.0+ installed. Once you have cloned the repository you should first install the dependencies:

```
npm install
npm ci
```

You also need a global dependency on the TypeScript compiler:
Expand All @@ -19,17 +19,8 @@ npm install -g typescript
Then make a copy of `bot.json` called `bot.prod.json` and fill in the correct values. These will be used when starting the bot. To compile and run the bot, run:

```
npm run-script build
npm run-script start runBot
```

## Send a webhook

The code also allows you to send a webhook. Copy `webhook.json` to `webhook.prod.json` and once you have the setup correctly, follow the same steps as above, but use `sendHook` as parameter instead:

```
npm run-script build
npm run-script start sendHook
npm run build
npm run start
```

## Contributing
Expand Down
3 changes: 1 addition & 2 deletions bot.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"commandPrefix": "!",
"clientId": "application_id_from_dev_portal",
"token": "add_bot_secret_here",
"owner": ["discord_user_id"],
"activity": ""
}
4 changes: 1 addition & 3 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module.exports = {
apps : [{
name: 'QuestBot',
script: './dist/index.js',

args: 'runBot',
instances: 1,
autorestart: true,
watch: false,
Expand All @@ -22,7 +20,7 @@ module.exports = {
ref : 'origin/master',
repo : 'https://github.com/clanquest/questbot.git',
path : '/home/node/questbot',
'post-deploy' : 'npm install && npm run-script build && pm2 reload ecosystem.config.js --env production'
'post-deploy' : 'npm ci && npm run build && pm2 reload ecosystem.config.js --env production'
}
}
};
Loading

0 comments on commit d784f83

Please sign in to comment.