App-RoboBot
view release on metacpan or search on metacpan
lib/App/RoboBot/Message.pm view on Meta::CPAN
225226227228229230231232233234235236237238239240241242243244245
$plugin
->hook_after(
$self
);
}
}
# Deliver the response
$self
->
log
->debug(
'Issuing response send.'
);
$self
->response->
send
;
}
sub
update_response_channel {
my
(
$self
,
$new_channel
,
$old_channel
) =
@_
;
if
(
$self
->has_response &&
$self
->has_channel) {
$self
->response->channel(
$new_channel
);
}
}
__PACKAGE__->meta->make_immutable;
1;
lib/App/RoboBot/Nick.pm view on Meta::CPAN
858687888990919293949596979899100101102103104105
die
$self
->
log
->fatal(
'Could not generate nick ID.'
)
unless
$self
->has_id;
}
# TODO basic normalization of nicks (removing trailing underscores and single
# digits from automatic nick renames for dupe connections)
$self
->update_permissions;
}
sub
update_permissions {
my
(
$self
) =
@_
;
$self
->
log
->debug(
sprintf
(
'Permissions update request for nick %s.'
,
$self
->name));
# TODO: Restore old functionality of per-server permissions. Pre-AnyEvent
# the information to do so was missing, but now we have it back.
$self
->
log
->debug(
'Collecting default permissions.'
);
my
%denied
;
lib/App/RoboBot/Plugin/API/Translate.pm view on Meta::CPAN
131132133134135136137138139140141142143144145146147148149150151
if
(
$self
->update_token) {
$self
->valid_config(1);
}
else
{
$self
->valid_config(0);
}
}
else
{
$self
->valid_config(0);
}
}
sub
update_token {
my
(
$self
) =
@_
;
# last_authed only changes when it was successful, so if we have a current
# one, skip all the work ahead
return
1
if
$self
->last_authed >
time
() - 590;
my
$client
=
$self
->bot->config->plugins->{
'translate'
}{
'client'
};
my
$secret
=
$self
->bot->config->plugins->{
'translate'
}{
'secret'
};
lib/App/RoboBot/Plugin/Social/Karma.pm view on Meta::CPAN
157158159160161162163164165166167168169170171172173174175176177
}, {
nick_id
=>
$nick
->id,
karma
=> -1,
from_nick_id
=>
$message
->sender->id,
});
}
return
;
}
sub
update_karma {
my
(
$self
,
$message
) =
@_
;
my
%nicks
= (
$message
->raw =~ m{([A-Za-z0-9_]+)([+-]{2})}ogs);
return
unless
scalar
(
keys
%nicks
) > 0;
foreach
my
$nick
(
keys
%nicks
) {
my
$karma_amount
=
$nicks
{
$nick
} eq
'++'
? 1 : -1;
my
$res
=
$self
->bot->config->db->
do
(q{
( run in 0.597 second using v1.01-cache-2.11-cpan-49f99fa48dc )