|
1 |
| -# [ScheduleBot | Dota Edition](https://mellamopablo.github.io/schedulebot/) |
2 |
| -> A Discord bot that makes scheduling easy |
3 |
| -
|
4 |
| -*Note: you're currently viewing the Dota version. This version supports Dota 2 inhouses and its |
5 |
| -configuration is a bit trickier because you need a Steam Bot. If you're looking for the standard |
6 |
| -version, [go here](https://github.com/MeLlamoPablo/schedulebot/tree/master#schedulebot).* |
7 |
| - |
8 |
| -ScheduleBot is a bot that manages events, such as a practice game with your team, or a league |
9 |
| -inhouse, or a tournament match. |
10 |
| - |
11 |
| -## Features |
12 |
| - |
13 |
| -* **Dota inhouses**: the Dota version makes it easy to create inhouses, as you can link an event |
14 |
| -to an inhouse. A Dota bot will automatically create a lobby and invite every player who have |
15 |
| -confirmed their attendance. |
16 |
| -* **Time zone handling**: ScheduleBot manages timezons for you. If there are European and |
17 |
| -American people on your team, if an European creates an event, Americans will be able to convert |
18 |
| -it to their timezone with the `convert` command. |
19 |
| -* **Confirm and reject handling**: ScheduleBot allows users to confirm or deny their attendance |
20 |
| -to an event, so you can see who and how many people are you gonna play with. ScheduleBot can also |
21 |
| - limit how many people can attend an event. |
22 |
| -* **Admin commands**: ScheduleBot allows elevated privilege commands with `schedulebot-admin`. |
23 |
| -Admins can perform actions such as removing events, or blacklisting an user to prevent them to |
24 |
| -use the bot. |
25 |
| -* **Linking an event to a role**: ScheduleBot allows events to be linked to a role, so that |
26 |
| -members of that role can be notified when they are required to confirm or deny attendance to an |
27 |
| -event. |
28 |
| - |
29 |
| -## Local installation |
30 |
| - |
31 |
| -To run ScheduleBot Dota Edition locally, you will need: |
| 1 | +# Heroku deployment guide |
| 2 | + |
| 3 | +*Note: you're currently viewing the Dota version. This version supports Dota 2 inhouses and its |
| 4 | +configuration is a bit trickier because you need a Steam Bot. If you're looking for the standard |
| 5 | +version, go |
| 6 | +[here](https://github.com/MeLlamoPablo/schedulebot/tree/heroku#heroku-deployment-guide).* |
| 7 | + |
| 8 | +*If you're looking for the local installation instructions, go |
| 9 | +[here](https://github.com/MeLlamoPablo/schedulebot/tree/dota#schedulebot--dota-edition).* |
| 10 | + |
| 11 | +If you wanted to host ScheduleBot locally, you'd need to have your computer on 24/7 to have your |
| 12 | +bot always online. To avoid that, we could use a PaaS provider, such as |
| 13 | +[Heroku](https://www.heroku.com/). Heroku's free plan is good enough for hosting our bot. |
| 14 | + |
| 15 | +## Deployment instructions |
| 16 | + |
| 17 | +To deploy ScheduleBot to Heroku, you will need: |
32 | 18 |
|
33 | 19 | * [NodeJS](https://nodejs.org/en/download/) 6 or above.
|
34 |
| -* [PostgreSQL](https://www.postgresql.org/download/). |
35 |
| - * You'll need to create an empty database for ScheduleBot. |
36 |
| -* [git](https://git-scm.com/downloads), so you can easily clone this repo (optional). |
37 |
| -* A second [Steam](http://steamcommunity.com/) account for your bot. |
| 20 | +* [git](https://git-scm.com/downloads). |
38 | 21 |
|
39 |
| -Start by cloning this repo, and then install the dependencies: |
| 22 | +First, [sign up to Heroku](https://signup.heroku.com/), and create an app. You may deploy your |
| 23 | +bot using the Heroku CLI, or GitHub. I recommend GitHub, as it's easier. If you choose Heroku |
| 24 | +CLI, follow the instructions there. If you choose GitHub, first fork this repository. Then, clone |
| 25 | +your fork and checkout the `heroku-dota` branch, and install the dependencies: |
40 | 26 |
|
41 | 27 | ```sh
|
42 |
| -$ git clone https://github.com/MeLlamoPablo/schedulebot.git |
| 28 | +$ git clone https://github.com/<your_github_username>/schedulebot.git |
43 | 29 | $ cd schedulebot
|
| 30 | +$ git checkout heroku-dota |
44 | 31 | $ npm install
|
45 | 32 | ```
|
46 | 33 |
|
47 |
| -And edit the bot's settings in `config.js`. You can edit or leave whatever you want, but you |
48 |
| -should at least edit: |
| 34 | +The `heroku-dota` branch is ready to be compatible with Heroku. The differences from `dota` are: |
| 35 | + |
| 36 | +* The database settings are no longer stored in `config.js`, as they are provided by Heroku through |
| 37 | +an environment variable. |
| 38 | +* The `package.json` file is modified to tell Heroku to use Node 6. |
| 39 | +* A `Procfile` with your bot's process is included. |
| 40 | + |
| 41 | +Now edit the bot's settings in `config.js`. You can edit or leave whatever you want, but you should |
| 42 | +at least edit: |
49 | 43 |
|
50 | 44 | * `master_channel` with the Discord channel where your bot will operate.
|
51 | 45 | * If you don't know how to get it, go to Discord's settings, then `Appearance`, then check
|
52 | 46 | `Developer Mode`. After that, right click on your channel, and click `Copy ID`.
|
53 | 47 | * `default_timezone` with the time zone which will be used by the bot.
|
54 |
| -* `db` with yout postgres database settings. |
55 |
| -* `steam.profile_url` with your Steam bot's profile URL. |
56 | 48 |
|
57 |
| -Now, make sure that your postgres server is running, and run the database setup script: |
| 49 | +Next step is configuring your database. In your app's dashboard, go to `Resources`, and under |
| 50 | +`Add-ons`, click `Find more add-ons`. Then search `Heroku Posgres` and add it to your app. The |
| 51 | +free version is good enough for personal use. |
| 52 | + |
| 53 | +After adding it, you'll find it under the `Add-ons` section. Click on it to your Heroku Postgres |
| 54 | +dashboard, and then click on your newly created Datastore. Scroll down to `Database Credentials`, |
| 55 | + and click `View Credentials`. Now run the setup script entering those credentials: |
58 | 56 |
|
59 | 57 | ```sh
|
60 | 58 | $ npm run setup
|
61 | 59 | ```
|
62 | 60 |
|
63 |
| -The script will take your database settings from `config.js`, so you can just go ahead and press |
64 |
| -enter. When asked if you want to connect over SSL, unless you have configured your postgres |
65 |
| -server to use it, you should say no. Then follow the script's instructions to finish the setup. |
66 |
| - |
67 |
| -After that, you need to configure your Steam credentials: |
| 61 | +After that, you need to configure your Steam credentials. You'll need to re-enter your Heroku |
| 62 | +Postgres database credentials on the Steam setup script. |
68 | 63 |
|
69 | 64 | ```sh
|
70 | 65 | $ npm run setup-steam
|
71 | 66 | ```
|
72 | 67 |
|
73 |
| -Follow the script's instructions and you're good to go. You can run then your bot with: |
| 68 | +Follow the script's instructions. After you're done, you're ready to push your repo to GitHub: |
74 | 69 |
|
75 | 70 | ```sh
|
76 |
| -$ npm run bot |
| 71 | +$ git add . |
| 72 | +git commit -m "Ready to deploy" |
| 73 | +$ git push --all |
77 | 74 | ```
|
78 | 75 |
|
79 |
| -## Usage guide |
| 76 | +Before deploying your bot, let's add your bot user to your Discord server. In order to do so, go |
| 77 | +to the [Discord dev center](https://discordapp.com/developers/applications/me/) and click on your |
| 78 | +application, then grab your Client ID. Then go to the following link in your browser: |
| 79 | + |
| 80 | +``` |
| 81 | +https://discordapp.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot&permissions=0x00002000 |
| 82 | +``` |
80 | 83 |
|
81 |
| -After installing your bot, you might want to check out the |
| 84 | +Replace `YOUR_CLIENT_ID` by your bot's client ID. Don't forget to grant the "Manage Messages" |
| 85 | +permission. |
| 86 | + |
| 87 | +Now, in your Heroku dashboard, go to `Deploy`, select `GitHub`, connect your account, and add |
| 88 | +your fork. Be sure to select the `heroku-dota` branch. |
| 89 | + |
| 90 | +The first build should be triggered. When it's done, navigate to `Resources`, and, if everything |
| 91 | +went right, you should see two Dynos: `web`, and `bot`. Shutdown `web`, as we don't need it, and |
| 92 | +turn on `bot`. After that, your bot will be loaded. Go to the top right corner, under `More`, |
| 93 | +then `View Logs` to see the console log. If you see the message |
| 94 | +`[INFO] ScheduleBot finished loading.`, the bot is live. Congratulations! |
| 95 | + |
| 96 | +# Usage guide |
| 97 | + |
| 98 | +After deploying your bot, you might want to check out the |
82 | 99 | [usage guide](https://github.com/MeLlamoPablo/schedulebot/blob/dota/usage/usage-guide.md).
|
83 | 100 |
|
84 | 101 | ## Updating
|
@@ -122,19 +139,4 @@ When prompted to select the current version, select the version you took note of
|
122 | 139 | to select the target version, you generally want to select the latest. After that, enter your
|
123 | 140 | database credentials, and your database will also be updated to the selected version.
|
124 | 141 |
|
125 |
| -You're now ready to run your bot again. |
126 |
| - |
127 |
| -## Deploying to Heroku |
128 |
| - |
129 |
| -If you wanted to host ScheduleBot locally, you'd need to have your computer on 24/7 to have your bot |
130 |
| -always online. To avoid that, we could use a PaaS provider, such as Heroku. Heroku's free plan is |
131 |
| -good enough for hosting our bot. To learn how to deploy the bot to heroku, |
132 |
| -[go here](https://github.com/MeLlamoPablo/schedulebot/tree/heroku-dota#heroku-deployment-guide). |
133 |
| - |
134 |
| -## Changelog |
135 |
| - |
136 |
| -The change log can be found at the [releases section](https://github.com/MeLlamoPablo/schedulebot/releases). |
137 |
| - |
138 |
| -## License |
139 |
| - |
140 |
| -Apache-2.0 © [Pablo Rodríguez](https://github.com/MeLlamoPablo) |
| 142 | +You're now ready to run your bot again. |
0 commit comments