mirror of
https://github.com/ENSL/ensl_gathers.git
synced 2025-02-21 11:11:23 +00:00
Added basic bot commands
This commit is contained in:
parent
861fc57757
commit
9b80a26361
3 changed files with 19 additions and 9 deletions
6
index.js
6
index.js
|
@ -8,12 +8,12 @@ var server = require('http').Server(app);
|
|||
var io = require('socket.io')(server);
|
||||
var config = require(path.join(__dirname, "config/config.js"));
|
||||
|
||||
// Initialise Steam Bot
|
||||
require(path.join(__dirname, "lib/steam/bot"))(config.steamBot);
|
||||
|
||||
// Load Models
|
||||
require(path.join(__dirname, "db/index"));
|
||||
|
||||
// Initialise Steam Bot
|
||||
require(path.join(__dirname, "lib/steam/bot"))(config.steamBot);
|
||||
|
||||
// Configure express
|
||||
require(path.join(__dirname, "config/express"))(app);
|
||||
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
"use strict";
|
||||
|
||||
var _ = require("lodash");
|
||||
var steam = require("steam");
|
||||
var winston = require("winston");
|
||||
var password = process.env.GATHER_STEAM_PASSWORD;
|
||||
var account_name = process.env.GATHER_STEAM_ACCOUNT;
|
||||
var Gather = require("../gather/gather_singleton");
|
||||
|
||||
function SteamBot(config) {
|
||||
let self = this;
|
||||
|
@ -19,15 +21,19 @@ function SteamBot(config) {
|
|||
self.friends.sendMessage(steamId, "Removed your from gather");
|
||||
};
|
||||
|
||||
let returnGatherInfo = (steamId, message) => {
|
||||
self.friends.sendMessage(steamId, "Current Gather Status: Gathering (2/12 Players)");
|
||||
let returnGatherInfo = (steamId, _) => {
|
||||
let gather = Gather.current;
|
||||
let state = gather.current.toUpperCase();
|
||||
let players = gather.gatherers.length;
|
||||
let message = "Current Gather: " + state + " (" + players + "/12 Players)";
|
||||
self.friends.sendMessage(steamId, message);
|
||||
};
|
||||
|
||||
let showHelp = (steamId, message) => {
|
||||
self.friends.sendMessage(steamId, "Bot Commands:");
|
||||
self.friends.sendMessage(steamId, "!info - Get information on current gather");
|
||||
self.friends.sendMessage(steamId, "!join - Join current gather");
|
||||
self.friends.sendMessage(steamId, "!leave - Leave current gather");
|
||||
// self.friends.sendMessage(steamId, "!join - Join current gather");
|
||||
// self.friends.sendMessage(steamId, "!leave - Leave current gather");
|
||||
};
|
||||
|
||||
let confirmFriend = steamId => {
|
||||
|
@ -70,8 +76,8 @@ function SteamBot(config) {
|
|||
self.friends.on('friendMsg', (steamId, message, EChatEntryType) => {
|
||||
winston.info(message);
|
||||
if (message.match(/^!help/i)) return showHelp(steamId, message);
|
||||
if (message.match(/^!join/i)) return addToGather(steamId, message);
|
||||
if (message.match(/^!leave/i)) return removeFromGather(steamId, message);
|
||||
// if (message.match(/^!join/i)) return addToGather(steamId, message);
|
||||
// if (message.match(/^!leave/i)) return removeFromGather(steamId, message);
|
||||
if (message.match(/^!info/i)) return returnGatherInfo(steamId, message);
|
||||
});
|
||||
|
||||
|
|
|
@ -65,6 +65,10 @@ html, body {
|
|||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.previous-headline {
|
||||
margin-top: 2em;
|
||||
};
|
||||
|
||||
.jumbo-auth {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue