Skip to content

Commit

Permalink
Added update scripts for the dota branch.
Browse files Browse the repository at this point in the history
The bot will also save the sentry file to the database if found in the local machine.
  • Loading branch information
MeLlamoPablo committed Dec 15, 2016
1 parent fdf1d82 commit 514dade
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 3 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,36 @@ $ npm run bot
After installing your bot, you might want to check out the
[usage guide](https://github.com/MeLlamoPablo/schedulebot/blob/dota/usage/usage-guide.md).

## Updating

Updating your bot is easy. First, you need to know which version you have installed. To do so, go
to Discord and run the command:

```
@ScheduleBot --help
```

*Note: replace `@ScheduleBot` with your app's prefix*. Take note of the current version.

After that, stop your bot. Then, replace your current files with the latest version files. If you
used `git` to clone the repository, this is easy:

```sh
$ git pull --all
```

However, your bot is not ready yet. A database update is also required:

```sh
$ npm run update
```

When prompted to select the current version, select the version you took note of. When prompted
to select the target version, you generally want to select the latest. After that, enter your
database credentials, and your database will also be updated to the selected version.

You're now ready to run your bot again.

## Deploying to Heroku

If you wanted to host ScheduleBot locally, you'd need to have your computer on 24/7 to have your bot
Expand Down
10 changes: 10 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,16 @@ startupPromises.push(
fs.readFile("./sentry", (err, sentryFile) => {
if (!err) {
console.log("[STEAM] Found sentry file on the local machine.");

// Attempt to save it to the database
db.config.steam.saveSentryFile(sentryFile).then(() => {
console.log("[STEAM] Saved sentry file to the database.");
}).catch(err => {
console.log("[STEAM] Couldn't save the sentry file to the" +
"database:");
consle.error(err);
});

fulfill(sentryFile);
} else {
if (err.code === "ENOENT") {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "schedulebot",
"version": "1.0.4",
"version": "1.0.5",
"description": "A Discord bot that makes scheduling easy",
"homepage": "https://github.com/mellamopablo/schedulebot#readme",
"author": "Pablo Rodríguez <pabloviolin8@gmail.com> (https://github.com/MeLlamoPablo)",
Expand All @@ -17,13 +17,15 @@
"bot": "node ./lib/index.js",
"setup": "node ./setup.js",
"setup-steam": "node ./setup-steam.js",
"update": "node ./scripts/update.js",
"prepublish": "gulp nsp",
"postinstall": "node ./postinstall.js"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-nsp": "^2.1.0",
"gulp-plumber": "^1.0.0",
"gulp-nsp": "^2.1.0"
"semver": "^5.3.0"
},
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion scripts/shared/versions.json
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
[]
[
"v1.0.5-dota",
"v1.0.4-dota",
"v1.0.3-dota"
]
1 change: 1 addition & 0 deletions scripts/sql/1.0.3-to-1.0.4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE public.config ADD steam_sentry_file BYTEA DEFAULT NULL NULL;
1 change: 1 addition & 0 deletions scripts/sql/1.0.4-to-1.0.5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--noop

0 comments on commit 514dade

Please sign in to comment.