-
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.
Fixed some things + status command (untested)
- Loading branch information
1 parent
5594b93
commit 07a80e5
Showing
8 changed files
with
92 additions
and
35 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,40 @@ | ||
"use strict"; | ||
|
||
const Clapp = require("../../modules/clapp-discord"); | ||
|
||
module.exports = new Clapp.Command({ | ||
name: "status", | ||
desc: "Gets information about the Discord bot and Steam bots sent to you on a DM", | ||
fn: (argv, context) => { | ||
return new Promise((fulfill, reject) => { | ||
let bots = context.dotaHandler.bots; | ||
|
||
let msg = "Hello! Here's the bot status information:\n\n"; | ||
|
||
let genValueString = (key, value, newline = true) => { | ||
return `- **${key}**: \`${value}\`${newline ? "\n" : ""}`; | ||
}; | ||
|
||
msg += genValueString("Uptime", context.summaryHandler.bot.uptime); | ||
|
||
for (let i = 0; i < bots.length; i++) { | ||
let bot = bots[i]; | ||
|
||
msg += genValueString( | ||
`Bot #${bot.id}`, | ||
context.dotaHandler.isBotInLobby(bot.id) | ||
? `In lobby: ${bot.currentLobby.name} (Event #${bot.currentLobby.event.id})` | ||
: `Not in lobby`, | ||
i === bots.length | ||
); | ||
} | ||
|
||
context.msg.author.sendMessage(msg) | ||
.then(() => fulfill("The information you requested was sent to you in a DM.")) | ||
.catch(reject); | ||
}); | ||
}, | ||
args: [ | ||
require("./shared/event") | ||
] | ||
}); |
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
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