| 1 | =head1 NAME | ||||||||||
| 2 | |||||||||||
| 3 | IRC::Bot::Hangman::Command::Profanity - Profanity filter | ||||||||||
| 4 | |||||||||||
| 5 | =head1 SYNOPSIS | ||||||||||
| 6 | |||||||||||
| 7 | See IRC::Bot::Hangman | ||||||||||
| 8 | |||||||||||
| 9 | =head1 DESCRIPTION | ||||||||||
| 10 | |||||||||||
| 11 | This module is a plugin providing | ||||||||||
| 12 | profanity filtering. | ||||||||||
| 13 | |||||||||||
| 14 | =head1 COMMANDS | ||||||||||
| 15 | |||||||||||
| 16 | <hangman> *profanity word* | ||||||||||
| 17 | |||||||||||
| 18 | =cut | ||||||||||
| 19 | |||||||||||
| 20 | package IRC::Bot::Hangman::Command::Profanity; | ||||||||||
| 21 | 1 | ▶ | use warnings::register; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | 1 | ▶ | use Regexp::Common qw/profanity/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 1 | ▶ | use Carp qw( carp ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | |||||||||||
| 28 | =head1 METHODS | ||||||||||
| 29 | |||||||||||
| 30 | =head2 name() | ||||||||||
| 31 | |||||||||||
| 32 | This plugin's name = 'profanity' | ||||||||||
| 33 | |||||||||||
| 34 | =cut | ||||||||||
| 35 | |||||||||||
| 36 | sub name () { 'profanity' } | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | =head2 pre_process() | ||||||||||
| 40 | |||||||||||
| 41 | Filter out any profanity | ||||||||||
| 42 | |||||||||||
| 43 | =cut | ||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub pre_process { | ||||||||
|
Subroutine
pre_process: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 46 | 0 | my $self = shift; | |||||||||
| 47 | 0 | my $robot = shift; | |||||||||
| 48 | |||||||||||
| 49 | 0 | ▶ | return unless ($robot->input =~ /$RE{profanity}/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 50 | |||||||||||
| 51 | 0 | $robot->set_response( 'profanity' ); | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | 1 | 1; | |||||||||
| 57 | |||||||||||
| 58 | |||||||||||
| 59 | =head1 AUTHOR | ||||||||||
| 60 | |||||||||||
| 61 | Pierre Denis <pierre@itrelease.net> | ||||||||||
| 62 | |||||||||||
| 63 | http://www.itrelease.net/ | ||||||||||
| 64 | |||||||||||
| 65 | =head1 COPYRIGHT | ||||||||||
| 66 | |||||||||||
| 67 | Copyright 2005 IT Release Ltd - All Rights Reserved. | ||||||||||
| 68 | |||||||||||
| 69 | This module is released under the same license as Perl itself. | ||||||||||
| 70 | |||||||||||
| 71 | =cut | ||||||||||
| 72 | |||||||||||
| 73 | |||||||||||