diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..184803a --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018-present Michael Scofield + +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. diff --git a/README.md b/README.md index e82099f..fae2077 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Once you've done this, setting the anti spam up will be very easy. And you can follow the code below to get started! ```js -var antispam = require("discord-anti-spam"); +const antispam = require("discord-anti-spam"); antispam(bot, { warnBuffer: 3, //Maximum amount of messages allowed to send in the interval time before getting warned. diff --git a/anti_spam.js b/anti_spam.js index 8ea7854..d312349 100644 --- a/anti_spam.js +++ b/anti_spam.js @@ -20,12 +20,12 @@ module.exports = function (bot, options) { const maxDuplicatesBan = (options && options.duplicates || 10); const deleteMessagesAfterBanForPastDays = (options && options.deleteMessagesAfterBanForPastDays || 7); - bot.on('message', msg => { + bot.on("message", msg => { - //Always return with an bot..... - if(msg.author.bot) return; + // bots don't ban do they? + if (msg.author.bot) return; - if(msg.author.id != bot.user.id){ + if ( (msg.author.id != bot.user.id) && msg.channel.guild) { var now = Math.floor(Date.now()); authors.push({ "time": now, diff --git a/package.json b/package.json index ff8472f..417986b 100644 --- a/package.json +++ b/package.json @@ -21,5 +21,5 @@ }, "homepage": "https://github.com/Michael-J-Scofield/discord-anti-spam#readme", "author": "Michael Scofield", - "license": "ISC" + "license": "MIT" }