2020-07-27 05:54:03 +02:00
## Setting Up Discord
2017-04-23 23:13:27 +02:00
Create server in Discord.
Create text channel for logs.
Create roles `Admins` and `Moderators` .
Invite Bot to your Server (see **Creating a Bot User** below).
Make bot a Moderator.
2020-07-27 05:54:03 +02:00
## Install & Dependencies
2020-05-02 07:35:33 +02:00
Install Node.js and Yarn.
2017-04-23 23:13:27 +02:00
Install forever (task scheduler).
```sh
2020-05-02 07:35:33 +02:00
yarn global add forever
2017-04-23 23:13:27 +02:00
```
Clone repository and install package dependencies.
```sh
git clone https://github.com/citra-emu/discord-bot.git
cd discord-bot
2020-05-02 07:35:33 +02:00
yarn
2017-04-23 23:13:27 +02:00
```
Create new JSON file for bot config with the following contents in the directory specified below:
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
**For Development:** `./config/development.json`
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
**For Production:** `./config/production.json`
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
```JSON
{
"logChannel": "",
"clientLoginToken": ""
}
```
To get `logChannel` , type `\#YOUR_CHANNEL_NAME` in your Discord server chat.
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
Copy string of numbers **after** `#` into `"logChannel": ""`
![](http://i.imgur.com/PdcXVCD.png)
Copy App Bot User token to `"clientLoginToken": ""`
![](http://i.imgur.com/YTGZju9.png)
2020-07-27 05:54:03 +02:00
## Running Bot
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
##### For Production
2017-04-23 23:22:27 +02:00
2020-05-02 07:35:33 +02:00
First yo need to build the project by running `yarn build` .
2017-04-23 23:13:27 +02:00
`./start.sh` Requires a config/production.json file.
2017-04-23 23:22:27 +02:00
2017-04-23 23:13:27 +02:00
##### For Development
2017-04-23 23:22:27 +02:00
2020-05-02 07:35:33 +02:00
`yarn serve` Requires a config/development.json file.
2017-04-23 23:13:27 +02:00
2020-07-27 05:54:03 +02:00
## License
2017-04-23 23:13:27 +02:00
GNU General Public License v2.0
2020-07-27 05:54:03 +02:00
## Creating a Bot User.
2017-04-23 23:13:27 +02:00
First you need to go to [discord developers ](https://discordapp.com/developers/applications/me ) and click "New Application"
![Application Screen ](http://i.imgur.com/FvgfY2Z.png )
Now give your bot a name and a picture, a description isn't necessary.
![New Application Screen ](http://i.imgur.com/MOS7yvH.png )
Click "Create Application". On the next page scroll down until you see "Create a bot user", click that. Also click yes do it.
![Screen you see after creating a new application then scrolling down a little. ](http://i.imgur.com/YAzK5ml.png )
![Yes Do It. ](http://i.imgur.com/vkF6Rxo.png )
Now you can get your bot's token, by using the "click to reveal button" in the app bot user section. Remember to uncheck `Public Bot`
![New Bot Page ](http://i.imgur.com/xhKMUVU.png )
![Token ](http://i.imgur.com/QwCmJJM.png )
There's your token! Now its time to invite your bot to your server. Don't worry about your bot being started for this next step. Change the `client_id` in the URL to your Client ID under App Details, then go to this url ```https://discordapp.com/oauth2/authorize?& client_id=YOUR_CLIENT_ID_HERE& scope=bot& permissions=0```
![Authorize Bot ](http://i.imgur.com/Ggwy0BP.png )
Now select your sever, then click authorize.
![Authorized ](http://i.imgur.com/4cqNcs1.png )
That's it! Now you can start your bot.