App-RoboBot

 view release on metacpan or  search on metacpan

lib/App/RoboBot/Message.pm  view on Meta::CPAN

225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
            $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

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
        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

131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
        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'};
 
    my $response = $self->ua->post('https://datamarket.accesscontrol.windows.net/v2/OAuth2-13',

lib/App/RoboBot/Plugin/Social/Karma.pm  view on Meta::CPAN

157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
        }, {
            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 )