Skip to content

Commit

Permalink
v1.2 - Closes #12
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit c4fcd1b
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Tue Jan 24 13:03:58 2017 +0100

    Added some config options. Final v1.2 commit-

commit 64e97d7
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Mon Jan 23 14:11:24 2017 +0100

    Added enfore MMR ability

commit 9b35426
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 20 12:23:23 2017 +0100

    Removed uneccessary comment

commit b69cc92
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 20 12:21:00 2017 +0100

    The bot is able to retrieve the Match ID

commit 47f41fe
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Tue Jan 17 21:52:10 2017 +0100

    Bug fixes

commit 10ebaff
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Mon Jan 16 13:12:16 2017 +0100

    Updated usage guide

commit dc4989e
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Mon Jan 16 13:02:08 2017 +0100

    Added CM Pick option (Needs testing)

commit 35c3bfd
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sun Jan 15 17:32:46 2017 +0100

    Finished MMR support.

commit 3749e1e
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sun Jan 15 02:08:46 2017 +0100

    Fetching MMR from OpenDota

commit 021bae7
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sat Jan 14 17:19:16 2017 +0100

    Merge branch 'dota-feature-multiple-steam-bots'

    Squashed commit of the following:

    commit ff26b5d
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Sat Jan 14 17:15:09 2017 +0100

        Works apparently.

    commit bed8095
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Fri Jan 13 11:34:17 2017 +0100

        small progress

    commit 07a80e5
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Thu Jan 12 20:47:31 2017 +0100

        Fixed some things + status command (untested)

    commit 5594b93
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Thu Jan 12 14:06:28 2017 +0100

        Seems to work now

    commit e864b89
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Thu Jan 12 13:26:51 2017 +0100

        Getting an error on lobby creation

    commit 100c4df
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Wed Jan 11 20:41:56 2017 +0100

        Still a wip...

    commit 64bb4e1
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Wed Jan 11 13:30:49 2017 +0100

        Forgot to upload the next version sql changes

    commit 977b5cb
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Wed Jan 11 13:29:45 2017 +0100

        Still a wip

        I'm making soooooo much changes without testing, but I can't right now. Debugging is gonna be fun.

    commit 403bf75
    Merge: 227c59a 4b005fd
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Wed Jan 11 12:01:08 2017 +0100

        Merge branch 'dota-dev' into dota-feature-multiple-steam-bots

    commit 227c59a
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Sat Jan 7 14:22:57 2017 +0100

        Still a work in progress

        Rewriting the dotahandler module.

    commit 5d1aa84
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Fri Jan 6 21:38:12 2017 +0100

        Doesn't work so far

    commit a95b25e
    Author: Pablo Rodríguez <pabloviolin8@gmail.com>
    Date:   Fri Jan 6 13:28:27 2017 +0100

        Changed scripts to work with multiple bots

commit 4b005fd
Merge: cacfeb8 86629b0
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 11 12:00:38 2017 +0100

    Merge branch 'dota' into dota-dev

commit 86629b0
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 11 11:48:07 2017 +0100

    v1.1.1 - Closes #9 and #10

commit cacfeb8
Merge: 69caf3c d30d919
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 6 11:43:09 2017 +0100

    Merged branch dota into dota-dev

commit d30d919
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 6 01:16:39 2017 +0100

    Update README.md

    Added a link to the changelog

commit 0051ff2
Merge: b6084b2 69caf3c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 6 01:00:43 2017 +0100

    ScheduleBot for Dota v1.1.0

    Merged branch dota-dev into dota

commit 69caf3c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 6 00:51:44 2017 +0100

    Ready to launch v1.1.0

commit 12bc1e8
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Jan 6 00:26:44 2017 +0100

    Added kick admin command

commit 0885aa6
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 23:18:25 2017 +0100

    Two additions

    - Added quick-inhouse command
    - Players now get autoinvited if they confirm after a lobby is created.

commit 61358f1
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 23:02:41 2017 +0100

    fix #5

commit 61b1a5b
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 22:30:55 2017 +0100

    Removed uneccessary statements

commit 0c5a85e
Merge: a31e7b2 6b02935
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 22:21:39 2017 +0100

    Merged branch feature-ticketed-lobbies into dota-dev

commit 6b02935
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 21:35:27 2017 +0100

    Ticketing now works!

commit a31e7b2
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 17:36:27 2017 +0100

    Fixed bugg with summaries

commit dd24d53
Merge: 54cec51 b1730c5
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 17:18:22 2017 +0100

    Merged branch dota-dev into feature-ticketed-lobbies

commit b1730c5
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 17:12:16 2017 +0100

    Added TODO so I don't forget to update the setup script

    And knowing myself I porbably will anyways :)

commit 6124102
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 17:10:00 2017 +0100

    Added support for instant events + more

    - Replaced the "lobby_ended" field in the database with "lobby_status", whose type is the enum ELobbyStatus
    - Some tweaks to the event summaries

commit b3b7e45
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 14:53:11 2017 +0100

    Changed --limit default value to 10

commit 54cec51
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Jan 5 14:03:12 2017 +0100

    Began working on ticketing support

    Also updated node-dota2

commit 5e56849
Merge: f0ed8cd 75422c5
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 16:16:25 2017 +0100

    Merged branch master into dota-dev

    Updated usage guide

commit f0ed8cd
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 16:08:22 2017 +0100

    Modified config.js for clarification

commit 73f1f49
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 15:58:59 2017 +0100

    Bugfix - Closes #7

commit 47b9050
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 15:51:07 2017 +0100

    Enforce inhouse event limit to be >= 10

    Also fixes a bug where events without inhouses couldn't be removed.

commit 2e74881
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 15:37:55 2017 +0100

    Bugfix - Closes #6

commit 8f0913e
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 14:08:44 2017 +0100

    Un-hardcoded the time fortmat

    Americans need to use MM/DD/YYY

commit 26870a5
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 13:59:47 2017 +0100

    Add more servers

    Added servers: Singapore, Dubai, Austria, Brazil, South Africa, Chile,
    Peru, India, Japan

commit 5809103
Merge: b6084b2 e3b700c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Jan 4 13:31:17 2017 +0100

    Merged branch dota-feature-more-gamemodes into dota-dev

commit e3b700c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Tue Jan 3 20:33:46 2017 +0100

    Added more gamemodes

    Game modes added: Captains Draft, Random Draft, Single Draft, All Random,
    Ranked All Pick

commit b6084b2
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Tue Jan 3 20:44:23 2017 +0100

    Added better links on apps descriptions

commit dd4100d
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Mon Jan 2 15:58:47 2017 +0100

    Added link to home page

commit 045873c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Mon Jan 2 00:27:05 2017 +0100

    Minor bug fix

    The command link-steam wouldn't show the readable prefix.

commit d24271c
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sun Jan 1 02:35:02 2017 +0100

    Small changes

    Moved "dota edition only" to clear URLs

commit e488916
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Dec 16 12:34:25 2016 +0100

    Update README.md

commit 514dade
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 15 13:22:37 2016 +0100

    Added update scripts for the dota branch.

    The bot will also save the sentry file to the database if found in the local machine.

commit fdf1d82
Merge: 7d5a0d2 88a1420
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 15 13:11:18 2016 +0100

    Merge branch 'master'

    Conflicts:
    	README.md
    	lib/commands/general/confirm.js
    	package.json

commit 7d5a0d2
Merge: 5ffe987 4ce81ce
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Dec 14 13:22:48 2016 +0100

    Merged branch dota into dota

commit 5ffe987
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Dec 14 13:21:27 2016 +0100

    Now saving the sentry file in the database

    Heroku's free plan may restart the app at any time, and delete the sentry file. Thus, the bot would crash because it wouldn't be able to log in to Steam.

commit 4ce81ce
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sun Dec 11 14:28:46 2016 +0100

    I should proofread more often

commit 53f7c35
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sat Dec 10 16:34:15 2016 +0100

    Fix examples

commit adbfab7
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sat Dec 10 13:47:51 2016 +0100

    Update README.md

    - Added git checkout dota so that the master branch isn't used
    - Fixed heroku link pointing to heroku instead of heroku-dota

commit 6fb5196
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sat Dec 10 13:25:33 2016 +0100

    Fixed bug in db_setup.sql

    ID being INTEGER and not SERIAL would cause internal errors with the "create" command.

commit 761e4c1
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Sat Dec 10 12:46:10 2016 +0100

    Fixed bot crashing after lobby is closed

    Until Arcana/node-dota2#378 is merged, schedulebot will be using the fork from tomasmck

commit e30da47
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Fri Dec 9 00:27:52 2016 +0100

    Fix setup script

commit f65b105
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 23:31:20 2016 +0100

    Added link to dota usage guide

commit f25d7a4
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 23:28:50 2016 +0100

    Fix typo in README.md

commit 477558a
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 23:21:21 2016 +0100

    Done!

commit a580772
Merge: 530ebcb 5cb8724
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 23:01:27 2016 +0100

    Merge branch 'master' into 'dev-steam'

    Conflicts:
    	lib/modules/summaryhandler/index.js
    	package.json

commit 530ebcb
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 22:46:13 2016 +0100

    It works! Added setup script. Need more work on the usage guide

commit 5ca7ac0
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Thu Dec 8 00:29:53 2016 +0100

    Should be ready now

commit 19d7d64
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Wed Dec 7 14:10:30 2016 +0100

    Progress on Dota lobbies

    Now the bot is able to create lobbies and start with force-lobby-start

commit cad0207
Author: Pablo Rodríguez <pabloviolin8@gmail.com>
Date:   Tue Dec 6 16:17:34 2016 +0100

    Began working on Steam-Dota2 support
  • Loading branch information
MeLlamoPablo committed Jan 24, 2017
1 parent 02e0a38 commit 13e28a3
Show file tree
Hide file tree
Showing 49 changed files with 3,547 additions and 345 deletions.
76 changes: 67 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# ScheduleBot
# [ScheduleBot | Dota Edition](https://mellamopablo.github.io/schedulebot/)
> A Discord bot that makes scheduling easy
*Note: you're currently viewing the Standard version. There is also a Dota 2 version available,
which supports the automatic creation of inhouse lobbies in the game Dota 2. If you're looking
for that version, click
[here](https://github.com/MeLlamoPablo/schedulebot/tree/dota#schedulebot--dota-edition).*
*Note: you're currently viewing the Dota version. This version supports Dota 2 inhouses and its
configuration is a bit trickier because you need a Steam Bot. If you're looking for the standard
version, [go here](https://github.com/MeLlamoPablo/schedulebot#schedulebot).*

ScheduleBot is a bot that manages events, such as a practice game with your team, or a league
inhouse, or a tournament match.

## Features

* **Dota inhouses**: the Dota version makes it easy to create inhouses, as you can link an event
to an inhouse. A Dota bot will automatically create a lobby and invite every player who have
confirmed their attendance.
* **Time zone handling**: ScheduleBot manages timezons for you. If there are European and
American people on your team, if an European creates an event, Americans will be able to convert
it to their timezone with the `convert` command.
Expand All @@ -26,18 +28,20 @@ event.

## Local installation

To run ScheduleBot locally, you will need:
To run ScheduleBot Dota Edition locally, you will need:

* [NodeJS](https://nodejs.org/en/download/) 6 or above.
* [PostgreSQL](https://www.postgresql.org/download/).
* You'll need to create an empty database for ScheduleBot.
* [git](https://git-scm.com/downloads), so you can easily clone this repo (optional).
* A second [Steam](http://steamcommunity.com/) account for your bot.

Start by cloning this repo, and then install the dependencies:

```sh
$ git clone https://github.com/MeLlamoPablo/schedulebot.git
$ cd schedulebot
$ git checkout dota
$ npm install
```

Expand All @@ -49,6 +53,7 @@ should at least edit:
`Developer Mode`. After that, right click on your channel, and click `Copy ID`.
* `default_timezone` with the time zone which will be used by the bot.
* `db` with yout postgres database settings.
* `steam.profile_url` with your Steam bot's profile URL.

Now, make sure that your postgres server is running, and run the database setup script:

Expand All @@ -60,7 +65,13 @@ The script will take your database settings from `config.js`, so you can just go
enter. When asked if you want to connect over SSL, unless you have configured your postgres
server to use it, you should say no. Then follow the script's instructions to finish the setup.

After that, you're good to go. You can run your bot with:
After that, you need to configure your Steam credentials:

```sh
$ npm run setup-steam
```

Follow the script's instructions and you're good to go. You can run then your bot with:

```sh
$ npm run bot
Expand All @@ -69,14 +80,61 @@ $ npm run bot
## Usage guide

After installing your bot, you might want to check out the
[usage guide](https://github.com/MeLlamoPablo/schedulebot/blob/master/usage/usage-guide.md).
[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
```

If you forked this repo to deploy to Heroku, this will not work, because it's pulling from your
repo, and not from this one. To solve that, first [configure this repo (MeLlamoPablo/schedulebot)
as a remote for your fork (YOUR_GITHUB_USERNAME/schedulebot)](https://help.github.com/articles/configuring-a-remote-for-a-fork/).
Then, [fetch this repo](https://help.github.com/articles/syncing-a-fork/)
*(change `master` to `dota` or `heroku-dota`, depending on what branch you're working with)*.

After that, perform another npm install to make sure that you get any new dependencies or update
existing ones:

```
$ npm install
```

However, after all of this 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
always online. To avoid that, we could use a PaaS provider, such as Heroku. Heroku's free plan is
good enough for hosting our bot. To learn how to deploy the bot to heroku,
[go here](https://github.com/MeLlamoPablo/schedulebot/tree/heroku#heroku-deployment-guide).
[go here](https://github.com/MeLlamoPablo/schedulebot/tree/heroku-dota#heroku-deployment-guide).

## Changelog

The change log can be found at the [releases section](https://github.com/MeLlamoPablo/schedulebot/releases).

## Changelog

Expand Down
90 changes: 89 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = {
// The bot's command prefix. The bot will recognize as command any message that begins with it.
// i.e: "-schedulebot foo" will trigger the command "foo",
// whereas "ScheduleBot foo" will do nothing at all.
//
// If you replace YOUR_BOT_USER_ID with your bot's user ID, the prefix will be a mention to
// your bot. You can get that ID in https://discordapp.com/developers/applications/me/
// (click on your application, and find it under "App Details" > "Client ID"
prefix: "<@YOUR_BOT_USER_ID>",

// This is a readable version of the prefix. Generally, this is the same as prefix, but if
Expand Down Expand Up @@ -41,6 +45,14 @@ module.exports = {
// List of accepted timezones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
default_timezone: "Europe/Madrid",

// The time format that will be used for the create command. The bot will read a date string
// and will attempt to interpret it as the following format. If the passed time doesn't
// match the format, the command will result in an error.
//
// A list of valid format tokens can be found at:
// http://momentjs.com/docs/#year-month-and-day-tokens
time_format: "DD/MM/YYYY HH:mm",

// If this option is enabled, the bot will delete the message that triggered it, and its own
// response, after the specified amount of time has passed.
// Enable this if you don't want your channel to be flooded with bot messages.
Expand All @@ -49,19 +61,95 @@ module.exports = {
// More info: https://discordapp.com/developers/docs/topics/permissions
delete_after_reply: {
enabled: true,
time: 60000, // In milliseconds
time: 60000 // In milliseconds
},

// If true, it will delete any message that is not a command from the master channel.
// Leave this on to keep your master channel tidy.
// This also requires the "manage messages" permission
disallow_talking: true,

// If false, all (non-blacklisted) users will be able to add inhouses to created events.
// If true, only admins will be able to do so.
add_inhouse_is_admin_command: false,

// quick-inhouse command
// This command creates an instant lobby and adds an inhouse with the default values.
// It is the equivalent of running "@ScheduleBot create (event_name) now" and
// "@ScheduleBot add-inhouse (id)".
quick_inhouse: {
// If false, the command won't be included in the bot, and won't even show on the help.
enabled: true,

// The command name. If you changed this to "qh", the command would be executed as
// @ScheduleBot qh
command_name: "quick-inhouse",

// The created event's name, which is then used as a lobby name. (So you could customize
// this with your guild's name, for instance)
event_name: "Inhouse"
},

db: {
"user": "",
"password": "",
"host": "",
"database": ""
},

steam: {
// The name that the Steam bots will take. It will be appended with "#id" as in "#1".
name: "ScheduleBot",

// The first bot's profile URL. It's needed to redirect users to it.
profile_url: "http://steamcommunity.com/profiles/YOUR_BOT_ID/"
},

dota: {
// The default inhouse server, which will be used if the user doesn't pass the
// --server flag to the add-inhouse command.
// Go to that command's file (Or type -schedulebot add-inhouse --help)
// to see possible values.
default_server: "Luxembourg",

// If false, lobbies will be started automatically when ten people join it
// (spectators, casters and unassigned players not counted).
// If true, the games will only be able to be started with the admin command
// schedulebot-admin force-lobby-start (event)
disable_autostart: false,

// If enabled is true, the bot will ticket any lobbies using the provided league id.
// Make sure that the steam bot is an admin of that league.
ticketing: {
enabled: false,
league_id: 12345
},

// If enabled is true, the bot will fetch MMR from OpenDota for every user that links
// their Steam account, and display it in event summaries.
//
// The user must have the "Expose Public Match Data" option enabled, must be displaying
// their MMR on their Dota profile, and must have signed in OpenDota at least once, using
// Steam. If OpenDota doesn't know the user MMR, ScheduleBot won't either, and will display
// a "MMR Unknown message"
mmr: {
enabled: true,

// If enforce is true, the bot will only allow people who have their MMR publicly
// exposed in OpenDota to confirm any events. This is useful for competitive leagues
// who need to control MMR; it's recommended to leave it false otherwise.
enforce: false,

// ScheduleBot will update all users' MMR on each interval.
update_interval: 8 // In hours
},

// In a competitive league, you might want to change this with "match" or "game",
// since it's not technically an inhouse.
//
// CAREFUL! This will change the name of the command "add-inhouse"
// to "add-whatever_you_write"
game_generic_name: "inhouse"
}
};

Expand Down
35 changes: 0 additions & 35 deletions db_setup.sql

This file was deleted.

20 changes: 8 additions & 12 deletions lib/commands/admin/add-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,14 @@ module.exports = new Clapp.Command({
return new Promise((fulfill, reject) => {
let id = argv.args.user.match(/<@([0-9]+)>/)[1];
context.summaryHandler.bot.fetchUser(id).then(user => {
if (user !== null) {
db.admins.add(user).then(added => {
if (added) {
context.botAdmins.push(user.id);
fulfill("The user was added as an admin.", context);
} else {
fulfill("Error: the user is already in the admin list");
}
}).catch(reject);
} else {
fulfill("Error: the specified user doesn't exist.");
}
db.admins.add(user).then(added => {
if (added) {
context.botAdmins.push(user.id);
fulfill("The user was added as an admin.", context);
} else {
fulfill("Error: the user is already in the admin list");
}
}).catch(reject);
}).catch(err => {
if (err.status === 404) {
fulfill("Error: the specified user doesn't exist.");
Expand Down
30 changes: 30 additions & 0 deletions lib/commands/admin/force-lobby-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"use strict";

const Clapp = require("../../modules/clapp-discord")
, ECloseLobbyError = require("../../structures/enums/ECloseLobbyError")
, db = require("../../modules/dbhandler")
;

module.exports = new Clapp.Command({
name: "force-lobby-start",
desc: "Forces the lobby for the specified event to start, even if there aren't enough players.",
fn: (argv, context) => {
return new Promise((fulfill, reject) => {
db.events.get(argv.args.event).then(event => {
if (event !== null) {
db.events.getLobbyBotId(event)
.then(botID => {
fulfill(`Forced lobby start for the event ${event.id}.`);
context.dotaHandler.forceLobbyStart(botID).catch(reject);
})
.catch(reject);
} else {
fulfill("Error: the specified event `" + argv.args.event + "` doesn't exist.");
}
}).catch(reject);
});
},
args: [
require("./shared/event")
]
});
39 changes: 39 additions & 0 deletions lib/commands/admin/get-lobby.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use strict";

const Clapp = require("../../modules/clapp-discord")
, db = require("../../modules/dbhandler").events
;

module.exports = new Clapp.Command({
name: "get-lobby",
desc: "Gets the current lobby name and password sent to you on a DM",
fn: (argv, context) => {
return new Promise((fulfill, reject) => {
db.events.get(argv.args.event).then(event => {
if (event === null) {
fulfill("Error: the specified event `" + argv.args.event + "` doesn't exist.");
} else {
db.getLobbyBotId(event).then(botID => {
let details = context.dotaHandler.getLobbyDetails(botID);

if (details === null) {
fulfill("The Dota bot is not in a lobby.");
} else {
context.msg.author.sendMessage(
"Hello! Here's the information you requested:\n\n" +

"- **Lobby name**: `" + details.name + "`\n" +
"- **Lobby password**: `" + details.password + "`"
).then(() => {
fulfill("The information you requested was sent to you in a DM.");
}).catch(reject);
}
}).catch(reject);
}
}).catch(reject);
});
},
args: [
require("./shared/event")
]
});
Loading

0 comments on commit 13e28a3

Please sign in to comment.