Skip to content

Commit

Permalink
Merge pull request #33 from marcmascarell/dev
Browse files Browse the repository at this point in the history
Scheduled matches, compact embeds, fixes & improvements
  • Loading branch information
marcmascarell authored Oct 20, 2018
2 parents 3bae8aa + ff64031 commit e6a0cb2
Show file tree
Hide file tree
Showing 81 changed files with 7,901 additions and 6,701 deletions.
Empty file added .prettierignore
Empty file.
5 changes: 5 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 4,
"trailingComma": "all",
"semi": false
}
84 changes: 45 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
Discord Matchmaking Bot
-----------------
## Discord Matchmaking Bot

Matchmaking bot made with [Discord.js](https://discord.js.org) (Node.js)

Features
----------
- Match creation
- Choose slots
- Choose map
- List matches
- Players can !join / !leave
- Game servers creation
- Only COD(1) supported for now.
- Provisioned (@DigitalOcean) for the match when all slots are filled and players get a private message with the server credentials to join
- Game servers are destroyed after some time if the server is empty
- Voice channels are created for the match and destroyed after some time
- Admins can request info for matches (included sensitive information like password and rcon)
- Matches get erased after a period of inactivity if they were not completed
- Matches get erased when all players leave
- Checks for game streams and alerts when a stream starts

Running the bot (Node.js 9.x)
----------
- `npm install`
- Fill the required tokens in `secrets.ts` (rename the `secrets.examples.ts`)
- `knex migrate:latest`
- (Optional) `knex seed:run` // To have some test data
- `npm run watch` / `npm run build` to compile ts files
- `npm run dev`
- Your bot should be ready
- Generate an invite to your desired channel:
## Features

- Match creation
- Choose slots
- Choose map
- List matches
- Players can !join / !leave
- Game servers creation
- Only COD(1) supported for now.
- Provisioned (@DigitalOcean) for the match when all slots are filled and players get a private message with the server credentials to join
- Game servers are destroyed after some time if the server is empty
- Voice channels are created for the match and destroyed after some time
- Admins can request info for matches (included sensitive information like password and rcon)
- Matches get erased after a period of inactivity if they were not completed
- Matches get erased when all players leave
- Checks for game streams and alerts when a stream starts

## Running the bot (Node.js 9.x)

- `npm install`
- Fill the required tokens in `secrets.ts` (rename the `secrets.examples.ts`)
- `knex migrate:latest`
- (Optional) `knex seed:run` // To have some test data
- `npm run watch` / `npm run build` to compile ts files
- `npm run dev`
- Your bot should be ready
- Generate an invite to your desired channel:

Put this in the bottom of `index.ts`

```js
bot.getClient().on('ready', async () => {
bot.getClient().on("ready", async () => {
try {
let link = await client.generateInvite(["ADMINISTRATOR"])
console.log(link)
Expand All @@ -42,10 +42,11 @@ bot.getClient().on('ready', async () => {
}
})
```

(You can erase the code block when you are done with the invitation)

Migrate & refresh
----------
## Migrate & refresh

```bassh
knex migrate:rollback
Expand All @@ -54,18 +55,16 @@ knex migrate:latest
knex seed:run
```

Utilities
----------
## Utilities

Get latest server snapshot
`node dist/Utilities/getSnap.js`

Get server passwords
`node dist/Utilities/getPasswords.js {serverName}`

## [Migrations](http://knexjs.org/#Migrations)

[Migrations](http://knexjs.org/#Migrations)
----------
Once you have finished writing the migrations, you can update the database matching your NODE_ENV by running:

`knex migrate:latest`
Expand All @@ -81,14 +80,21 @@ To rollback the last batch of migrations:
`knex seed:run`

Refresh:

```
knex migrate:rollback
knex migrate:latest
knex seed:run
```

## Code Style

We run a precommit hook that executes Prettier.

However, if you want to force Prettier's execution you can do it like this:

`npx prettier --write src/**/*`

## License

License
----------
MIT
19 changes: 19 additions & 0 deletions game-server-setup/secrets.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
firebase: {
"type": "",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
},
server: {
privatepassword: '',
defaultPassword: '',
defaultRcon: '',
}
}
Loading

0 comments on commit e6a0cb2

Please sign in to comment.