blob: f3f2c3bd05363221ac651e364b7cba35c073e664 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
use lib <lib>;
use IRC::Client;
use Pastebin::Shadowcat;
use Mojo::UserAgent:from<Perl5>;
class Bash {
has @!quotes;
has $!ua = Mojo::UserAgent.new;
constant $BASH_URL = 'http://bash.org/?random1';
method irc-to-me ($ where /bash/) {
start self!fetch-quotes and @!quotes.shift;
}
method !fetch-quotes {
@!quotes ||= $!ua.get($BASH_URL).res.dom.find('.qt').each».all_text;
}
}
.run with IRC::Client.new:
:nick<MahBot>
:host<localhost>
:channels<#zofbot>
:debug
:plugins(Bash.new)
:filters(
-> $text where .lines > 1 || .chars > 300 {
Pastebin::Shadowcat.new.paste: $text.lines.join: "\n";
}
)
|