-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Added quick-inhouse command - Players now get autoinvited if they confirm after a lobby is created.
- Loading branch information
1 parent
61358f1
commit 0885aa6
Showing
4 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use strict"; | ||
|
||
const Clapp = require('../../modules/clapp-discord/index') | ||
, cfg = require('../../../config') | ||
, db = require('../../modules/dbhandler'); | ||
|
||
module.exports = new Clapp.Command({ | ||
name: cfg.quick_inhouse.command_name, | ||
desc: "Quickly creates an inhouse with the default values. This is the equivalent of running " + | ||
`\`${cfg.readable_prefix} create ${cfg.quick_inhouse.event_name} now\` and then ` + | ||
`\`${cfg.readable_prefix} add-inhouse (id)\`.` , | ||
fn: (argv, context) => { | ||
return new Promise((fulfill, reject) => { | ||
let inhouseProps = { | ||
gameMode: "captainsmode", | ||
server: cfg.dota.defaultServer.toLowerCase().replace(" ", ""), | ||
autoBalance: true | ||
}; | ||
|
||
db.events.addInstant(cfg.quick_inhouse.event_name, 10) | ||
.then(id => db.events.get(id)) | ||
.then(event => new Promise((fulfill2, reject2) => { | ||
db.events.addInhouse(event, inhouseProps) | ||
.then(() => context.summaryHandler.updateSummary(event)) | ||
.then(msgId => event.updateMsgId(msgId)) | ||
.then(() => fulfill2(event.id)).catch(reject2); | ||
})).then(id => { | ||
fulfill(`Your inhouse has been created with id \`#${id}\`.`); | ||
}).catch(reject); | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters