line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Slack::RTM::Bot::Information;
|
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
58
|
use strict;
|
|
8
|
|
|
|
|
33
|
|
|
8
|
|
|
|
|
259
|
|
4
|
8
|
|
|
8
|
|
44
|
use warnings;
|
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
3164
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new {
|
7
|
2
|
|
|
2
|
0
|
141
|
my $pkg = shift;
|
8
|
2
|
|
|
|
|
9
|
my ($args) = {@_};
|
9
|
2
|
|
|
|
|
6
|
my $self = {
|
10
|
|
|
|
|
|
|
@_,
|
11
|
|
|
|
|
|
|
};
|
12
|
2
|
|
|
|
|
9
|
$self->{users} = &_parse_users($args);
|
13
|
2
|
|
|
|
|
9
|
$self->{channels} = &_parse_conversations($args);
|
14
|
2
|
|
|
|
|
14
|
return bless $self, $pkg;
|
15
|
|
|
|
|
|
|
}
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _parse_users {
|
18
|
2
|
|
|
2
|
|
5
|
my $args = shift;
|
19
|
2
|
|
|
|
|
6
|
my $users = {};
|
20
|
2
|
|
|
|
|
6
|
for my $user (@{$args->{users}}){
|
|
2
|
|
|
|
|
8
|
|
21
|
2
|
|
|
|
|
8
|
$users->{$user->{id}} = $user;
|
22
|
|
|
|
|
|
|
}
|
23
|
2
|
|
|
|
|
6
|
return $users;
|
24
|
|
|
|
|
|
|
}
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _parse_conversations {
|
27
|
2
|
|
|
2
|
|
6
|
my $args = shift;
|
28
|
2
|
|
|
|
|
4
|
my $conversations = {};
|
29
|
2
|
|
|
|
|
4
|
for my $conversation (@{$args->{channels}}){
|
|
2
|
|
|
|
|
6
|
|
30
|
2
|
|
|
|
|
7
|
$conversations->{$conversation->{id}} = $conversation;
|
31
|
|
|
|
|
|
|
}
|
32
|
2
|
|
|
|
|
4
|
return $conversations;
|
33
|
|
|
|
|
|
|
}
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _find_conversation_id {
|
36
|
1
|
|
|
1
|
|
1434
|
my $self = shift;
|
37
|
1
|
|
|
|
|
4
|
my ($name) = @_;
|
38
|
1
|
|
|
|
|
7
|
my $conversations = $self->{channels};
|
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
2
|
for my $key (keys %{$conversations}){
|
|
1
|
|
|
|
|
4
|
|
41
|
1
|
50
|
|
|
|
5
|
if($name eq $conversations->{$key}->{name}){
|
42
|
1
|
|
|
|
|
6
|
return $conversations->{$key}->{id};
|
43
|
|
|
|
|
|
|
}
|
44
|
|
|
|
|
|
|
}
|
45
|
0
|
|
|
|
|
0
|
return undef;
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _find_conversation_name {
|
49
|
2
|
|
|
2
|
|
6
|
my $self = shift;
|
50
|
2
|
|
|
|
|
6
|
my ($id) = @_;
|
51
|
2
|
|
|
|
|
5
|
my $conversations = $self->{channels};
|
52
|
2
|
50
|
|
|
|
13
|
return $conversations->{$id}->{name} if $conversations->{$id};
|
53
|
|
|
|
|
|
|
}
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub _find_user_name {
|
56
|
3
|
|
|
3
|
|
3262
|
my $self = shift;
|
57
|
3
|
|
|
|
|
21
|
my ($id) = @_;
|
58
|
3
|
|
|
|
|
9
|
my $users = $self->{users};
|
59
|
3
|
100
|
|
|
|
22
|
return $users->{$id}->{name} if $users->{$id};
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1;
|