Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kenany committed Dec 15, 2013
0 parents commit 551947b
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
*.log
18 changes: 18 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Copyright 2013 Kenan Yildirim <http://kenany.me/>

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# nwitch-excessive-caps

[![Dependency Status](https://gemnasium.com/nwitch/caps-rate.png)](https://gemnasium.com/nwitch/caps-rate)

nwitch plugin for blocking messages that have EXCESSIVE CAPS.

## Installation

``` bash
$ npm install --save nwitch-excessive-caps
```
29 changes: 29 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
var inherits = require('util').inherits;
var capsRate = require('caps-rate');

module.exports = function(NwitchPlugin) {
function Plugin(bot, client) {
NwitchPlugin.apply(this, arguments);

this.metadata = {
name: 'excessive-caps',
title: 'Excessive caps',
description: 'nwitch plugin for blocking screams',
version: '0.0.1',
author: 'Kenan Yildirim'
};

this.bot = bot;
this.client = client;
}

inherits(Plugin, NwitchPlugin);

this.client.addListener('message', function(from, to, message) {
if (message.length > 5 && capsRate(message) >= 0.55) {
this.client.say('.timeout ' + from + ' 2');
}
});

return Plugin;
};
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "nwitch-excessive-caps",
"version": "0.0.1",
"description": "nwitch plugin for blocking screams",
"keywords": [
"nwitch",
"nwitch-plugin"
],
"repository": "nwitch/nwitch-excessive-caps",
"license": "MIT",
"author": "Kenan Yildirim <kenan@kenany.me> (http://kenany.me/)",
"main": "index.js",
"dependencies": {
"caps-rate": "^1.0.2"
},
"peerDependencies": {
"nwitch": "^0.2.0"
}
}

0 comments on commit 551947b

Please sign in to comment.