diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2125666 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab05030 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +node_modules +*.log \ No newline at end of file diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..776c49e --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,18 @@ +Copyright 2013 Kenan Yildirim + +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. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..4378d17 --- /dev/null +++ b/README.md @@ -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 +``` \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..79e941e --- /dev/null +++ b/index.js @@ -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; +}; \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..aed7131 --- /dev/null +++ b/package.json @@ -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 (http://kenany.me/)", + "main": "index.js", + "dependencies": { + "caps-rate": "^1.0.2" + }, + "peerDependencies": { + "nwitch": "^0.2.0" + } +} \ No newline at end of file