-
Notifications
You must be signed in to change notification settings - Fork 4
Setup
It is recommended to set up a personal testing bot and Discord server in addition to the main "production" bot and Discord server.
Crate a Discord bot application.
Setup its OAuth permissions as shown and generate an invite link:
Keep your bots' token secret. Treat it as you would your account's password.
Finally, use the generated bot invite link to invite your bot to your Discord server.
Create a file named config.json
. This file will contains secrets (such as your bot token) and IDs (such as which
server and channel would you like the bot to listen to for commands, which roles to allow to use the bot, etc.). The
file should have the following structure:
{
"token": "", // Paste Discord bot token here
"serviceLocationWhiteList": [ // This is a list of servers the bot will be in
{
"guildId": "", // Paste server ID here
"ioChannelId": "", // Paste channel ID to be used to issue commands here
"commandAccessRoleIds": [ // Choose role(s) that will be needed to use the bot
"", // Paste role ID here
// Add more role Ids as desired
]
},
// Add more servers as desired.
],
"bgdc": { // Create a copy of the sheets and change the IDs for testing purposes, otherwise leave these IDs as-is
"msSessionsSheetId": "1WIQQltSMUtSGrN4J-1u6_2vjj7UxeVOj2DqyZVlBZlE",
"msSessionsSubjectRanges": {
"PROGA": "MsSessions!B27:K53",
"PROGB": "MsSessions!B56:K81",
"DESG": "MsSessions!B84:K109",
"A2D": "MsSessions!B112:K138",
"A3D": "MsSessions!B141:K166",
"SND": "MsSessions!B169:K194"
},
"attdetCsvGdriveFolderId": "1CjW7NGcleH8qr_0pndqinpWF2M-OaAEiaYGB7BUUxUPNST2vMKM57874XpJHB0VhtoOm8lbl",
"procdetCsvGdriveFolderId": "1JxIY4ufB4LEAmL0olV-GftWV3xq6YNdZYjL5zndn4_bTjuOlHYf8B_TjB9veMaLFBVBb0scH"
}
}
Optionally, you may use a JSON schema validator to validate your
config.json
file.
The config file schema is as follows, should you prefer to validate with a different tool:
Config file schema
{
"type": "object",
"additionalProperties": false,
"properties": {
"token": {
"type": "string"
},
"serviceLocationWhiteList": {
"type": "array",
"items": {
"type": "object",
"properties": {
"guildId": {
"type": "string"
},
"ioChannelId": {
"type": "string"
},
"commandAccessRoleIds": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": [
"guildId",
"ioChannelId",
"commandAccessRoleIds"
]
}
},
"bgdc": {
"type": "object",
"properties": {
"msSessionsSheetId": {
"type": "string"
},
"msSessionsSubjectRanges": {
"type": "object",
"properties": {
"PROGA": {
"type": "string"
},
"PROGB": {
"type": "string"
},
"DESG": {
"type": "string"
},
"A2D": {
"type": "string"
},
"A3D": {
"type": "string"
},
"SND": {
"type": "string"
}
},
"required": [
"PROGA",
"PROGB",
"DESG",
"A2D",
"A3D",
"SND"
]
},
"attdetCsvGdriveFolderId": {
"type": "string"
},
"procdetCsvGdriveFolderId": {
"type": "string"
}
},
"required": [
"msSessionsSheetId",
"msSessionsSubjectRanges",
"attdetCsvGdriveFolderId",
"procdetCsvGdriveFolderId"
]
}
},
"required": [
"token",
"serviceLocationWhiteList",
"bgdc"
]
}
Keep your config.json
file somewhere safe in case you need it again in the future.
This project contains features which rely on several Google APIs on the Google Cloud Platform.
Generate a key pair:
Rename it to gcreds.json
. Keep this file somewhere safe.
It is recommended to install nvm
to ease Node version management:
$ curl https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh > install.sh
$ chmod +x ./install.sh
$ ./install.sh
Refresh the terminal and verify the installation:
$ command -v nvm
nvm
Install Node and verify it is at version v16.6.0 or higher:
$ nvm install node
$ node --version
v17.3.0
Clone the repository and install the required packages:
$ git clone https://github.com/binudgdc/VCPA.git
$ cd ./VCPA
$ npm install
$ npm install -g typescript
Create a config.json
file to store secrets and IDs.
Finally, build and run the project:
$ tsc
$ node build/index.js
It is highly recommended to install WSL and use *nix tools:
PS> wsl --install
Otherwise, the following steps may be used instead:
Download and run the appropriate installer. Ensure the version is v16.6.0 or higher.
Installation Procedure
Download and install Github Desktop, then clone the repository.
Cloning Procedure
Open the repository root and install the required packages:
PS> npm install
PS> npm install -g typescript
Open the repository root in File Explorer and create a config.json
file to store secrets and IDs.
Obtain a gcreds.json
] file.
Finally, build and run the source:
PS> tsc
PS> node .\build\index.js