/
604.txt
32 lines (27 loc) · 1.11 KB
/
604.txt
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
31
32
[1]
[PRE(perl code)[
sub check_channel {
my ($self, $pig, $channel) = @_;
return unless $channel->is_active;
for my $feed (@{ $channel->feeds }) {
$feed->each_new_entry( $pig, sub {
my $entry = shift;
my $author = $entry->author;
my $title = $entry->title;
$title = '[SPAN[]]' if $title eq 'id:wakabatan' and $author eq 'wakabatan';
$pig->log->debug(
encode_utf8(sprintf( "%s: %s - %s",
($author || '[no name]'),
($title || '[no title]'),
($entry->link || '[no link]'))));
# TODO: メッセージフォーマットをconfigで指定できるよう
my @message;
push @message, sprintf '[%s] <%s>', $title, $entry->link;
push @message, substr $entry->content->body, 0, 500;
# $pig->privmsg( $self->bot_name, $channel->name, $message );
$pig->join($author, $channel->name);
$pig->privmsg( $author, $channel->name, $_ ) for @message;
});
}
}
]PRE]