| 1 | package Bot::IRC::X::WwwShorten; | ||
| 2 | # ABSTRACT: Bot::IRC plugin for automatic URL shortening | ||
| 3 | |||
| 4 | 2 | ▶ | use 5.016; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | ▶ | use exact; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 2 | ▶ | use WWW::Shorten qw( TinyURL makeashorterlink ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 2 | our $VERSION = '1.07'; # VERSION | |
| 10 | |||
| 11 | 1 | ▶ | sub init { |
|
Subroutine
init: called CC=1 SCAR=0.6
Pod
undocumented
| |||
| 12 | 1 | my ($bot) = @_; | |
| 13 | |||
| 14 | $bot->hook( | ||
| 15 | { | ||
| 16 | to_me => 1, | ||
| 17 | text => qr/^tiny\s+(?<url>\S+)/i, | ||
| 18 | }, | ||
| 19 | 0 | ▶ | sub { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 20 | 0 | my ( $bot, $in, $m ) = @_; | |
| 21 | 0 | $bot->reply_to( makeashorterlink( $m->{url} ) ); | |
| 22 | }, | ||
| 23 | 1 | ); | |
| 24 | |||
| 25 | 1 | $bot->helps( 'tiny' => 'Shorten URLs. Usage: <bot nick> tiny <url>.' ); | |
| 26 | } | ||
| 27 | |||
| 28 | 2 | 1; | |
| 29 | |||
| 30 | __END__ | ||