3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-23 12:29:26 +01:00

Revert "access"

This reverts commit 333c8de2ad.
This commit is contained in:
reality 2015-01-15 02:45:07 +00:00
parent 333c8de2ad
commit 97f44141b3
5 changed files with 39 additions and 339 deletions

View File

@ -295,8 +295,6 @@ var commands = function(dbot) {
commands['~ununsub'].regex = [/^ununsub ([^ ]+)$/, 2];
commands['~ustatus'].regex = [/^ustatus ([^ ]+)$/, 2];
commands['~sustatus'].regex = [/^sustatus ([^ ]+)$/, 2];
commands['~nunsub'].access = 'power_user';
commands['~ununsub'].access = 'power_user';
return commands;
};

View File

@ -1,258 +1,14 @@
{
"dict": "/usr/share/dict/british-english",
"puzzles": [
{
"type": "end",
"part": "er"
},
{
"type": "end",
"part": "or"
},
{
"type": "end",
"part": "ance"
},
{
"type": "end",
"part": "ence"
},
{
"type": "end",
"part": "ant"
},
{
"type": "end",
"part": "ent"
},
{
"type": "end",
"part": "ee"
},
{
"type": "end",
"part": "ess"
},
{
"type": "end",
"part": "ian"
},
{
"type": "end",
"part": "ism"
},
{
"type": "end",
"part": "ics"
},
{
"type": "end",
"part": "ist"
},
{
"type": "end",
"part": "ity"
},
{
"type": "end",
"part": "ment"
},
{
"type": "end",
"part": "ness"
},
{
"type": "end",
"part": "ship"
},
{
"type": "end",
"part": "tion"
},
{
"type": "end",
"part": "ation"
},
{
"type": "end",
"part": "ate"
},
{
"type": "end",
"part": "ify"
},
{
"type": "end",
"part": "ize"
},
{
"type": "end",
"part": "able"
},
{
"type": "end",
"part": "ible"
},
{
"type": "end",
"part": "al"
},
{
"type": "end",
"part": "ful"
},
{
"type": "end",
"part": "ish"
},
{
"type": "end",
"part": "ive"
},
{
"type": "end",
"part": "ous"
},
{
"type": "end",
"part": "ious"
},
{
"type": "end",
"part": "ly"
},
{
"type": "end",
"part": "ally"
},
{
"type": "start",
"part": "anti"
},
{
"type": "start",
"part": "bi"
},
{
"type": "start",
"part": "contra"
},
{
"type": "start",
"part": "di"
},
{
"type": "start",
"part": "dis"
},
{
"type": "start",
"part": "ex"
},
{
"type": "start",
"part": "extra"
},
{
"type": "start",
"part": "hyper"
},
{
"type": "start",
"part": "in"
},
{
"type": "start",
"part": "inter"
},
{
"type": "start",
"part": "intra"
},
{
"type": "start",
"part": "intro"
},
{
"type": "start",
"part": "macro"
},
{
"type": "start",
"part": "micro"
},
{
"type": "start",
"part": "mis"
},
{
"type": "start",
"part": "mono"
},
{
"type": "start",
"part": "multi"
},
{
"type": "start",
"part": "neo"
},
{
"type": "start",
"part": "non"
},
{
"type": "start",
"part": "omni"
},
{
"type": "start",
"part": "poly"
},
{
"type": "start",
"part": "post"
},
{
"type": "start",
"part": "pre"
"part": "en"
},
{
"type": "start",
"part": "re"
},
{
"type": "start",
"part": "retro"
},
{
"type": "start",
"part": "semi"
},
{
"type": "start",
"part": "sub"
},
{
"type": "start",
"part": "super"
},
{
"type": "start",
"part": "tri"
},
{
"type": "start",
"part": "un"
},
{
"type": "start",
"part": "uni"
},
{
"type": "start",
"part": "en"
},
{
"type": "end",
"part": "tain"
@ -266,5 +22,5 @@
"part": "under"
}
],
"allowed_chans": [ "#realitree", "#realitwo" ]
"allowed_chans": [ "#realitree" ]
}

View File

@ -8,12 +8,11 @@ var fs = require('fs'),
var wordcrimes = function(dbot) {
this.game = null;
this.internalAPI = {
'createPuzzle': function(channel) {
// if(_.random(0, 3) === 1) {
return this.internalAPI.createAnagramPuzzle(channel);
// }
this.commands = {
'~startgame': function(event) {
if(!this.game && _.include(this.config.allowed_chans, event.channel.name)) {
event.reply('WORD GAME STARTING IN 5 SECONDS');
setTimeout(function() {
var puzzle = this.puzzles[_.random(0, this.puzzles.length -1)],
solutions = _.filter(this.dict, function(word) {
if(puzzle.type === 'start') {
@ -26,78 +25,17 @@ var wordcrimes = function(dbot) {
this.game = {
'puzzle': puzzle,
'solutions': solutions,
'channel': channel,
'channel': event.channel.name,
'found': [],
'scores': {}
};
return true;
}.bind(this),
'createAnagramPuzzle': function(channel) {
var randomV = function(len) {
var chars = "aeiou";
return len ? chars.charAt(~~(Math.random()*chars.length)) + randomV(len-1) : "";
};
var randomC = function(len) {
var chars = "bcdfghklmnpqrstvwxyz";
return len ? chars.charAt(~~(Math.random()*chars.length)) + randomC(len-1) : "";
};
var puzzle = {
'type': 'anagram',
'part': (randomV(3) + randomC(6)).split('').sort(function(){return 0.5-Math.random();}).join('')
};
var partArr = puzzle.part.split(''),
solutions = _.filter(this.dict, function(word) {
return (word.length > 1 && _.difference(word.split(''), partArr).length === 0);
});
if(solutions.length < 30) {
return this.internalAPI.createAnagramPuzzle(channel);
if(puzzle.type === 'start') {
event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT START WITH ' + puzzle.part);
} else if(puzzle.type === 'end') {
event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT END IN ' + puzzle.part);
}
this.game = {
'puzzle': puzzle,
'solutions': solutions,
'channel': channel,
'found': [],
'scores': {}
};
return true;
}.bind(this)
};
this.commands = {
'~startgame': function(event) {
if(_.isNull(this.game) && _.include(this.config.allowed_chans, event.channel.name)) {
this.game = {};
event.reply('WORD GAME STARTING IN 5 SECONDS');
setTimeout(function() {
this.internalAPI.createPuzzle(event.channel.name);
var game = this.game;
if(game.puzzle.type === 'start') {
event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT START WITH ' + game.puzzle.part);
} else if(game.puzzle.type === 'end') {
event.reply('NAME ALL THE WORDS YOU CAN THINK OF THAT END IN ' + game.puzzle.part);
} else if(game.puzzle.type === 'anagram') {
event.reply('NAME ALL THE ANAGRAMS OF ' + game.puzzle.part);
}
/* setTimeout(function() {
if(!_.isNull(this.game)) {
event.reply('30 SECONDS REMAINING');
}
}.bind(this), 30000);*/
setTimeout(function() {
if(!_.isNull(this.game)) {
event.reply('10 SECONDS REMAINING');
}
}.bind(this), 20000);
setTimeout(function() {
if(!_.isNull(this.game)) {
if(this.game.found.length > 0) {
@ -109,10 +47,8 @@ var wordcrimes = function(dbot) {
}
this.game = null;
}
}.bind(this), 30000);
}.bind(this), 40000);
}.bind(this), 5000);
} else {
event.reply('GAME ALREADY RUNNING');
}
}
};

View File

@ -4,7 +4,6 @@ html(lang='en')
meta(charset='utf-8')
script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js")
script(type="text/javascript", src="/fs_edit.js")
script(type="text/javascritp" src="project.js")
link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro")
link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css")
link(rel='stylesheet', type='text/css', href='/styles.css')
@ -26,5 +25,5 @@ html(lang='en')
a#bread(href='/login') Login
script(type="text/javascript", src="/bootstrap/js/bootstrap.min.js")
script(type="text/javascript", src="/d3/d3.min.js")
script(type="text/javascript", src="/d3/d3.v3.min.js")
script(type="text/javascript", src="/script.js")

View File

@ -1,7 +1,18 @@
extends ../layout
block content
!!!
html(lang='#{curr839}')
head
meta(charset='utf-8')
script(type="text/javascript", src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js")
link(rel="stylesheet", type="text/css", href="http://fonts.googleapis.com/css?family=Source+Sans+Pro")
link(rel="stylesheet", type="text/css", href="/bootstrap/css/bootstrap.min.css")
link(rel='stylesheet', type='text/css', href='/styles.css')
link(rel="stylesheet", href="/project.css")
script(src="../project.js")
body
div.container
div#page
div#title #{pagetitle}
div.container#main
p.intro #{dquote}
section#git
h2 #{development}