Spamcheck is a simple gem which checks users and forum posts, comments and such for spam. It uses a Bayes like filtering system which can be configured to tailor your needs.
The following checks are performed and awarded points accordingly:
- DNS blacklist with RBL
- Location of user (by IP)
- Stopforumspam.com check
- IP for fake hostname
- Email domain and extension
- Number of links in message
- Number of messages for the user
- The date when the last message was created
- The date when the user was created
Add this line to your application's Gemfile:
gem 'spamcheck'
And then execute:
$ bundle
Or install it yourself as:
$ gem install spamcheck
You can add the following code to a initializer or add it your worker:
## Example
Spamcheck.settings = { spam_score: 40, disabled_rules: ['stopforumspam', 'dnsblacklist', 'country'] }
You can use the gem with the following line:
user = {
'ip' => '{ ip address }',
'email' => '{ email }',
'created_at' => '{ date time}',
'username' => '{ username }' }
context = {
'title' => '{ Title }',
'content' => '{ message }',
'previous_created_at' => '{ date time}',
'message_count' => '{ number }' }
Spamcheck.check(user, context)
- Fork it ( https://github.com/[my-github-username]/spamcheck/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request