-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
363 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- "node" | ||
|
||
after_script: "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js" |
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 |
---|---|---|
@@ -1,2 +1,35 @@ | ||
[![NPM](https://nodei.co/npm/b9-slander.png?compact=true)](https://nodei.co/npm/b9-slander/)<br /> | ||
[![Build Status](https://travis-ci.org/mhelgeson/b9-slander.svg?branch=master)](https://travis-ci.org/mhelgeson/b9-slander) | ||
[![Coverage Status](https://coveralls.io/repos/github/mhelgeson/b9-slander/badge.svg?branch=master)](https://coveralls.io/github/mhelgeson/b9-slander?branch=master) | ||
- - - | ||
|
||
# b9-slander | ||
A b9 slack bot plugin, which makes archaic, false, and damaging statements about users. | ||
A [b9](https://github.com/mhelgeson/b9) slack bot plugin, which makes archaic, false, and damaging statements about users. | ||
|
||
## Methods | ||
|
||
#### `b9.slander()` | ||
Returns a random slanderous string. | ||
|
||
## Commands | ||
|
||
#### `slander [user] [channel]` | ||
Make a random slanderous statement directed at a user. | ||
|
||
- **`user`** *`{String}`* <br /> | ||
Name of someone to target. Defaults to a randomly selected user. | ||
|
||
- **`channel`** *`{String}`* <br /> | ||
Optional `id` of a channel to use. Defaults to the current channel. | ||
|
||
## Examples | ||
|
||
``` | ||
usr: slander | ||
bot: bot is a dankish dizzy-eyed bedswerver | ||
``` | ||
|
||
``` | ||
usr: slander @mike | ||
bot: @mike is a clouted idle-headed zounderkite | ||
``` |
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,38 @@ | ||
var ADJ1 = require('./words/adj1'); | ||
var ADJ2 = require('./words/adj2'); | ||
var NOUN = require('./words/noun'); | ||
|
||
// random array element | ||
function random ( list ){ | ||
// rotate array for better distribution | ||
list.unshift( list.pop() ); | ||
// return a random value | ||
return list[ Math.floor( Math.random() * list.length ) ]; | ||
} | ||
|
||
module.exports = function( b9 ){ | ||
|
||
b9.command( | ||
'slander [user] [channel]', | ||
'Make false and damaging statements', | ||
function( msg ){ | ||
b9.send({ | ||
type: 'message', | ||
channel: msg.argv.channel || msg.channel, | ||
text: [ | ||
msg.argv.user || random( b9.users ).name, | ||
'is', | ||
b9.slander() | ||
].join(' ') | ||
}); | ||
} | ||
); | ||
|
||
b9.slander = function(){ | ||
return [ | ||
random( ADJ1 ), | ||
random( ADJ2 ), | ||
random( NOUN ) | ||
].join(' '); | ||
} | ||
}; |
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,25 @@ | ||
{ | ||
"name": "b9-slander", | ||
"description": "A b9 slack bot plugin, which makes archaic, false, and damaging statements about users.", | ||
"version": "0.0.0", | ||
"author": "Mike Helgeson <mike.helgeson+b9@gmail.com>", | ||
"contributors": [], | ||
"license": "MIT", | ||
"repository": "https://github.com/mhelgeson/b9-slander", | ||
"keywords": [ | ||
"slack", | ||
"bot", | ||
"b9" | ||
], | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.6", | ||
"istanbul": "^0.4.2", | ||
"mocha": "^2.2.5", | ||
"b9": "1.x" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "istanbul cover -x test.js _mocha -- -R spec test.js" | ||
} | ||
} |
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,70 @@ | ||
var assert = require('assert'); | ||
var B9 = require('b9'); | ||
var b9_slander = require('./index'); | ||
|
||
describe('src/index', function(){ | ||
|
||
var bot = new B9({ package:false }); | ||
bot.self.id = 'UB9M3'; | ||
bot.users = [{ name:'bot', id:'U123' }]; | ||
bot.install( b9_slander ); | ||
|
||
it('b9.slander() method',function(){ | ||
assert.equal( typeof bot.slander, 'function' ); | ||
assert.equal( typeof bot.slander(), 'string' ); | ||
assert.equal( bot.slander().length > 0, true ); | ||
}); | ||
|
||
it('registers `slander` command',function(){ | ||
// check the help command is defined | ||
simulate('help slander',function( txt ){ | ||
assert.equal( /Command not found/.test( txt ), false ); | ||
assert.equal( /slander/.test( txt ), true ); | ||
}); | ||
}); | ||
|
||
it('generates a slanderous statement',function(){ | ||
var sent; | ||
bot.send = function( msg ){ | ||
assert.equal( msg.type, 'message' ); | ||
assert.equal( msg.text.split(' ').length > 5, true ); | ||
sent = true; | ||
}; | ||
simulate('slander'); | ||
// make sure the assertions ran | ||
assert.equal( sent, true ); | ||
}); | ||
|
||
it('can be directed at any name',function(){ | ||
var sent; | ||
bot.send = function( msg ){ | ||
assert.equal( msg.type, 'message' ); | ||
assert.equal( msg.text.indexOf('Clu'), 0 ); | ||
sent = true; | ||
}; | ||
simulate('slander Clu'); | ||
// make sure the assertions ran | ||
assert.equal( sent, true ); | ||
}); | ||
|
||
it('can be directed to any channel',function(){ | ||
var sent; | ||
bot.send = function( msg ){ | ||
assert.equal( msg.type, 'message' ); | ||
assert.equal( msg.channel, '#C123' ); | ||
sent = true; | ||
}; | ||
simulate('slander user #C123'); | ||
// make sure the assertions ran | ||
assert.equal( sent, true ); | ||
}); | ||
|
||
// simulate an event | ||
function simulate ( str, reply ){ | ||
bot.emit('message', { | ||
text: ( str || '' ), | ||
channel: 'D' // direct msg | ||
}, reply ); | ||
} | ||
|
||
}); |
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,56 @@ | ||
[ | ||
"an artless", | ||
"an auricular", | ||
"a bawdy", | ||
"a bescumbing", | ||
"a beslubbering", | ||
"a bootless", | ||
"a churlish", | ||
"a cockered", | ||
"a clouted", | ||
"a craven", | ||
"a currish", | ||
"a daft", | ||
"a dankish", | ||
"a dissembling", | ||
"a droning", | ||
"an errant", | ||
"a fawning", | ||
"a frobbing", | ||
"a froward", | ||
"a frothy", | ||
"a gleeking", | ||
"a goatish", | ||
"a gorbellied", | ||
"an impertinent", | ||
"an infectious", | ||
"a jarring", | ||
"a loggerheaded", | ||
"a lumpish", | ||
"a mammering", | ||
"a mangled", | ||
"a mewling", | ||
"a paunchy", | ||
"a pribbling", | ||
"a puking", | ||
"a puny", | ||
"a qualling", | ||
"a rank", | ||
"a reeky", | ||
"a roguish", | ||
"a ruttish", | ||
"a saucy", | ||
"a spleeny", | ||
"a spongy", | ||
"a surly", | ||
"a tottering", | ||
"an unmuzzled", | ||
"an untrustworthy", | ||
"a vain", | ||
"a venomed", | ||
"a villainous", | ||
"a warped", | ||
"a wayward", | ||
"a weedy", | ||
"a yeasty" | ||
] |
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,67 @@ | ||
[ | ||
"addle-brained", | ||
"base-court", | ||
"bat-fowling", | ||
"beef-witted", | ||
"beetle-headed", | ||
"boil-brained", | ||
"clapper-clawed", | ||
"clay-brained", | ||
"common-kissing", | ||
"crook-pated", | ||
"decayed", | ||
"deformed", | ||
"dismal-dreaming", | ||
"dizzy-eyed", | ||
"doghearted", | ||
"dread-bolted", | ||
"earth-vexing", | ||
"elf-skinned", | ||
"fat-kidneyed", | ||
"fen-sucked", | ||
"flap-mouthed", | ||
"fly-bitten", | ||
"folly-fallen", | ||
"fool-born", | ||
"full-gorged", | ||
"guts-gripping", | ||
"hag-born", | ||
"half-faced", | ||
"hasty-witted", | ||
"hedge-born", | ||
"hell-hated", | ||
"idle-headed", | ||
"ill-bred", | ||
"ill-nurtured", | ||
"knotty-pated", | ||
"light-blinded", | ||
"long-tongued", | ||
"milk-livered", | ||
"motley-minded", | ||
"muddy-mottled", | ||
"onion-eyed", | ||
"open-arsed", | ||
"plume-plucked", | ||
"pottle-deep", | ||
"pox-marked", | ||
"prick-eared", | ||
"puisny-tilted", | ||
"puke-stockinged", | ||
"puppy-hatin'", | ||
"reeling-ripe", | ||
"rough-hewn", | ||
"rude-growing", | ||
"rump-fed", | ||
"shag-haired", | ||
"shard-borne", | ||
"sheep-biting", | ||
"spur-galled", | ||
"swag-bellied", | ||
"tallow-faced", | ||
"tardy-gaited", | ||
"tickle-brained", | ||
"toad-spotted", | ||
"urchin-snouted", | ||
"weather-bitten", | ||
"white-livered" | ||
] |
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,68 @@ | ||
[ | ||
"apple-john", | ||
"baggage", | ||
"barnacle", | ||
"bedswerver", | ||
"bladder", | ||
"boar-pig", | ||
"bugbear", | ||
"bum-bailey", | ||
"cacafuego", | ||
"canker-blossom", | ||
"clack-dish", | ||
"clotpole", | ||
"coccydynia", | ||
"coxcomb", | ||
"codpiece", | ||
"death-token", | ||
"dewberry", | ||
"flap-dragon", | ||
"flax-wench", | ||
"flirt-gill", | ||
"fool", | ||
"foot-licker", | ||
"fustilarian", | ||
"fustylugs", | ||
"giglet", | ||
"gnashgab", | ||
"gobermouch", | ||
"haggard", | ||
"harpy", | ||
"hedge-pig", | ||
"horn-beast", | ||
"hugger-mugger", | ||
"joithead", | ||
"lewdster", | ||
"lout", | ||
"lubberwort", | ||
"lummox", | ||
"maggot-pie", | ||
"malt-worm", | ||
"mammet", | ||
"measle", | ||
"miscreant", | ||
"moldwarp", | ||
"mumblecrust", | ||
"neckbeard", | ||
"nut-hook", | ||
"pecksniffian", | ||
"pigeon-egg", | ||
"pignut", | ||
"puttock", | ||
"pumpion", | ||
"rakefire", | ||
"rapscallion", | ||
"ratsbane", | ||
"roiderbanks", | ||
"scobberlotcher", | ||
"scut", | ||
"skainsmate", | ||
"strumpet", | ||
"varlot", | ||
"vassal", | ||
"whey-face", | ||
"wagtail", | ||
"wandought", | ||
"zoilist", | ||
"zounderkite" | ||
] |