.pj: activates autojoin; .pl deactivates autojoin
This commit is contained in:
parent
999c2960fd
commit
20c07af542
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"bot": {
|
"bot": {
|
||||||
"autojoin": true,
|
"autojoin": false,
|
||||||
"debug": true
|
"debug": false,
|
||||||
|
"pokerbot": "hirc",
|
||||||
|
"channel": "#poker"
|
||||||
},
|
},
|
||||||
"clients": [{
|
"clients": [{
|
||||||
"type": "irc",
|
"type": "irc",
|
||||||
|
|
|
@ -26,10 +26,9 @@ bot.on("notice", msg => {
|
||||||
});
|
});
|
||||||
|
|
||||||
bot.on("message", async e => {
|
bot.on("message", async e => {
|
||||||
if(e.channel !== '#poker') {
|
if(e.channel !== cfg.get('channel'))
|
||||||
return;
|
return;
|
||||||
}
|
if(e.message === `.${e.self.me.nickname} help`) {
|
||||||
if(e.message === '.schmirc help') {
|
|
||||||
await e.write(`PRIVMSG ${e.user.nick} I always say hirc schmirc, available commands are:`);
|
await e.write(`PRIVMSG ${e.user.nick} I always say hirc schmirc, available commands are:`);
|
||||||
const commands = [
|
const commands = [
|
||||||
' .pj -- poker join',
|
' .pj -- poker join',
|
||||||
|
@ -51,22 +50,24 @@ bot.on("message", async e => {
|
||||||
if(e.message.match(new RegExp(`^${e.self.me.nickname}: Your bank account`))) {
|
if(e.message.match(new RegExp(`^${e.self.me.nickname}: Your bank account`))) {
|
||||||
env.bank = +e.message.match(/is: (\d+) \(/)[1];
|
env.bank = +e.message.match(/is: (\d+) \(/)[1];
|
||||||
}
|
}
|
||||||
if(e.message === ".deb") {
|
if(e.message === ".debug") {
|
||||||
const tmp = await cfg.set('debug', !cfg.get('debug'));
|
const tmp = await cfg.set('debug', !cfg.get('debug'));
|
||||||
return e.reply(`${!tmp} -> ${tmp}`);
|
return e.reply(`debug mode ${tmp ? '[color=green]enabled[/color]' : '[color=red]disabled[/color]'}`);
|
||||||
}
|
}
|
||||||
if(e.message === ".aj") {
|
if(e.message === ".aj" || e.message === ".autojoin") {
|
||||||
const tmp = await cfg.set('autojoin', !cfg.get('autojoin'));
|
const tmp = await cfg.set('autojoin', !cfg.get('autojoin'));
|
||||||
return e.reply(`${!tmp} -> ${tmp}`);
|
return e.reply(`autojoin ${tmp ? '[color=green]enabled[/color]' : '[color=red]disabled[/color]'}`);
|
||||||
}
|
}
|
||||||
if(e.message === ".pj" || (e.message === "pj" && cfg.get('autojoin')) && !env.hand && !env.joined) {
|
if(e.message === ".pj" || (e.message === "pj" && cfg.get('autojoin')) && !env.hand && !env.joined) {
|
||||||
env.joined = true;
|
env.joined = true;
|
||||||
|
await cfg.set('autojoin', true);
|
||||||
//return e.reply("pj");
|
//return e.reply("pj");
|
||||||
return e.reply("bb\npj");
|
return e.reply(["bb", "pj"]);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(e.message === ".pl" && !env.hand) {
|
if(e.message === ".pl" && !env.hand) {
|
||||||
env.joined = false;
|
env.joined = false;
|
||||||
|
await cfg.set('autojoin', false);
|
||||||
return e.reply("pl");
|
return e.reply("pl");
|
||||||
}
|
}
|
||||||
if(e.message === ".bb" && !env.hand)
|
if(e.message === ".bb" && !env.hand)
|
||||||
|
@ -80,30 +81,39 @@ bot.on("message", async e => {
|
||||||
if(e.message === ".d" && !env.hand)
|
if(e.message === ".d" && !env.hand)
|
||||||
return e.reply("d");
|
return e.reply("d");
|
||||||
|
|
||||||
if(e.user.nick !== 'hirc' || !env.hand)
|
if(e.user.nick !== cfg.get('pokerbot') || !env.hand)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// tracker
|
// tracker
|
||||||
if(e.message.includes('raises the pot')) {
|
if(e.message.includes('raises the pot')) {
|
||||||
env.callamount = +e.message.match(/raises the pot by (\d+)/)[1];
|
env.callamount = +e.message.match(/raises the pot by (\d+)/)[1];
|
||||||
env.pot += env.callamount;
|
env.pot += env.callamount;
|
||||||
if(e.message.includes(e.self.me.nickname))
|
if(e.message.includes(e.self.me.nickname)) {
|
||||||
env.bank -= env.callamount;
|
env.bank -= env.callamount;
|
||||||
|
if(cfg.get('debug'))
|
||||||
|
e.reply(`bank: ${env.bank}`);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(e.message.includes('calls')) {
|
if(e.message.includes('calls')) {
|
||||||
env.callamount = +e.message.match(/calls (\d+)\./)[1];
|
env.callamount = +e.message.match(/calls (\d+)\./)[1];
|
||||||
env.pot += env.callamount;
|
env.pot += env.callamount;
|
||||||
if(e.message.includes(e.self.me.nickname))
|
if(e.message.includes(e.self.me.nickname)) {
|
||||||
env.bank -= env.callamount;
|
env.bank -= env.callamount;
|
||||||
|
if(cfg.get('debug'))
|
||||||
|
e.reply(`bank: ${env.bank}`);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(e.message.endsWith('blind).')) { // blinds
|
if(e.message.endsWith('blind).')) { // blinds
|
||||||
env.callamount = +e.message.match(/pays (\d+) \(/)[1];
|
env.callamount = +e.message.match(/pays (\d+) \(/)[1];
|
||||||
env.pot += env.callamount;
|
env.pot += env.callamount;
|
||||||
env.gamestate = 'preflop';
|
env.gamestate = 'preflop';
|
||||||
if(e.message.includes(e.self.me.nickname))
|
if(e.message.includes(e.self.me.nickname)) {
|
||||||
env.bank -= env.callamount;
|
env.bank -= env.callamount;
|
||||||
|
if(cfg.get('debug'))
|
||||||
|
e.reply(`bank: ${env.bank}`);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +129,7 @@ bot.on("message", async e => {
|
||||||
env.callamount = +e.message.match(/\((\d+) to call\)/)[1];
|
env.callamount = +e.message.match(/\((\d+) to call\)/)[1];
|
||||||
|
|
||||||
if(env.winchance < 6500) {
|
if(env.winchance < 6500) {
|
||||||
if(helper.rand(5) === 1 && env.callamount < 80) { // bad hand, call anyway
|
if(helper.rand(5) === 1 && env.callamount < (helper.rand(6,10) * 10)) { // bad hand, call anyway
|
||||||
action = 'c';
|
action = 'c';
|
||||||
}
|
}
|
||||||
else { // bad hand, fold
|
else { // bad hand, fold
|
||||||
|
@ -165,8 +175,12 @@ bot.on("message", async e => {
|
||||||
// gamestate & board changes
|
// gamestate & board changes
|
||||||
if(e.message.match(/^(Flop|Turn|River)/)) {
|
if(e.message.match(/^(Flop|Turn|River)/)) {
|
||||||
env.board = helper.parseCards(e.message);
|
env.board = helper.parseCards(e.message);
|
||||||
|
const oldstate = env.gamestate;
|
||||||
env.gamestate = e.message.match(/(\w+): /)[1].toLowerCase();
|
env.gamestate = e.message.match(/(\w+): /)[1].toLowerCase();
|
||||||
|
|
||||||
|
//if(cfg.get('debug'))
|
||||||
|
// e.reply(`${oldstate} -> ${env.gamestate}`);
|
||||||
|
|
||||||
const rank = handranker.evalHand([...env.board, ...env.hand]);
|
const rank = handranker.evalHand([...env.board, ...env.hand]);
|
||||||
env.winchance = rank.value;
|
env.winchance = rank.value;
|
||||||
}
|
}
|
||||||
|
@ -181,6 +195,9 @@ bot.on("message", async e => {
|
||||||
else {
|
else {
|
||||||
env.bank += +e.message.match(/pot(: | of size )(\d+)/)[2];
|
env.bank += +e.message.match(/pot(: | of size )(\d+)/)[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(cfg.get('debug'))
|
||||||
|
e.reply(`bank: ${env.bank}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
env.gamestate = 'preflop';
|
env.gamestate = 'preflop';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user