-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now the bot is able to create lobbies and start with force-lobby-start
- Loading branch information
1 parent
cad0207
commit 19d7d64
Showing
13 changed files
with
600 additions
and
54 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use strict"; | ||
|
||
const Clapp = require('../../modules/clapp-discord/index'); | ||
|
||
module.exports = new Clapp.Command({ | ||
name: "force-lobby-start", | ||
desc: "Forces the current lobby to start, even if there aren't enough players.", | ||
fn: (argv, context) => { | ||
return new Promise((fulfill, reject) => { | ||
context.dotaHandler.forceStart().catch(reject); | ||
fulfill("Forced current lobby start"); | ||
}); | ||
} | ||
}); |
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,23 @@ | ||
"use strict"; | ||
|
||
const Clapp = require('../../modules/clapp-discord/index'); | ||
|
||
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) => { | ||
let lobby = context.dotaHandler.currentLobbyName; | ||
let pass = context.dotaHandler.currentLobbyPassword; | ||
|
||
context.msg.author.sendMessage( | ||
"Hello! Here's the information you requested:\n\n" + | ||
|
||
"- **Current lobby name**: `" + lobby + "`\n" + | ||
"- **Current lobby password**: `" + pass + "`" | ||
).then(() => { | ||
fulfill("The information you requested was sent to you in a DM."); | ||
}).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
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,36 @@ | ||
"use strict"; | ||
|
||
const Clapp = require('../../modules/clapp-discord/index') | ||
, cfg = require('../../../config') | ||
, db = require('../../modules/dbhandler'); | ||
|
||
module.exports = new Clapp.Command({ | ||
name: "resend-invite", | ||
desc: "Resends an invite to the current lobby. You need to have confirmed attendance for" + | ||
" this to work.", | ||
fn: (argv, context) => { | ||
return new Promise((fulfill, reject) => { | ||
context.dotaHandler.currentLobbyEvent.getConfirms().then(people => { | ||
let confirmed = false; | ||
|
||
for (let i = 0; i < people.confirmed.length; i++) { | ||
let discordID = people.confirmed[i]; | ||
|
||
if (context.msg.author.id === discordID) { | ||
confirmed = true; | ||
} | ||
} | ||
|
||
if (confirmed) { | ||
context.dotaHandler.invite(context.msg.author.id).then(() => { | ||
fulfill("The invite has been resent. Accept it inside Dota 2."); | ||
}).catch(reject); | ||
} else { | ||
fulfill("Error: you haven't confirmed attendance to the event `#" + | ||
context.dotaHandler.currentLobbyEvent.id + "`.\n" + | ||
"You need to do so before requesting to be invited to the lobby"); | ||
} | ||
}).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
Oops, something went wrong.