line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
sub Mojo::Webqq::_send_group_message{ |
2
|
0
|
|
|
0
|
|
|
my($self,$msg) = @_; |
3
|
|
|
|
|
|
|
my $callback = sub{ |
4
|
0
|
|
|
0
|
|
|
my $json = shift; |
5
|
0
|
|
|
|
|
|
$msg->parse_send_status_msg( $json ); |
6
|
0
|
0
|
0
|
|
|
|
if( !$msg->is_success and $msg->ttl > 0){ |
7
|
0
|
|
|
|
|
|
$self->debug("消息[ " .$msg->id . " ]发送失败,尝试重新发送,当前TTL: " . $msg->ttl); |
8
|
0
|
|
|
|
|
|
$self->message_queue->put($msg); |
9
|
|
|
|
|
|
|
#$self->send_group_message($msg); |
10
|
0
|
|
|
|
|
|
return; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
else{ |
13
|
0
|
0
|
|
|
|
|
if(ref $msg->cb eq 'CODE'){ |
14
|
0
|
|
|
|
|
|
$msg->cb->( |
15
|
|
|
|
|
|
|
$self, |
16
|
|
|
|
|
|
|
$msg, |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
} |
19
|
0
|
|
|
|
|
|
$self->emit(send_message => |
20
|
|
|
|
|
|
|
$msg, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
my $api_url = ($self->security?'https':'http') . '://d1.web2.qq.com/channel/send_qun_msg2'; |
26
|
0
|
|
|
|
|
|
my $headers = { |
27
|
|
|
|
|
|
|
Referer => 'http://d1.web2.qq.com/proxy.html?v=20151105001&callback=1&id=2', |
28
|
|
|
|
|
|
|
json => 1, |
29
|
|
|
|
|
|
|
}; |
30
|
|
|
|
|
|
|
my @content = map { |
31
|
0
|
0
|
|
|
|
|
if($_->{type} eq "txt"){$_->{content}} |
|
0
|
0
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
elsif($_->{type} eq "face"){["face",0+$_->{id}]} |
33
|
0
|
|
|
|
|
|
} @{$msg->raw_content}; |
|
0
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#for(my $i=0;$i<@content;$i++){ |
35
|
|
|
|
|
|
|
# if(ref $content[$i] eq "ARRAY"){ |
36
|
|
|
|
|
|
|
# if(ref $content[$i] eq "ARRAY"){ |
37
|
|
|
|
|
|
|
# splice @content,$i+1,0," "; |
38
|
|
|
|
|
|
|
# } |
39
|
|
|
|
|
|
|
# else{ |
40
|
|
|
|
|
|
|
# $content[$i+1] = " " . $content[$i+1]; |
41
|
|
|
|
|
|
|
# } |
42
|
|
|
|
|
|
|
# } |
43
|
|
|
|
|
|
|
#} |
44
|
0
|
|
|
|
|
|
my $content = [@content,["font",{name=>"宋体",size=>10,style=>[0,0,0],color=>"000000"}]]; |
45
|
0
|
|
0
|
|
|
|
my %s = ( |
46
|
|
|
|
|
|
|
group_uin => $msg->group_id, |
47
|
|
|
|
|
|
|
face => $self->user->face || 591, |
48
|
|
|
|
|
|
|
content => $self->to_json($content), |
49
|
|
|
|
|
|
|
msg_id => $msg->id, |
50
|
|
|
|
|
|
|
clientid => $self->clientid, |
51
|
|
|
|
|
|
|
psessionid => $self->psessionid, |
52
|
|
|
|
|
|
|
); |
53
|
0
|
|
|
|
|
|
$self->http_post( |
54
|
|
|
|
|
|
|
$api_url, |
55
|
|
|
|
|
|
|
$headers, |
56
|
|
|
|
|
|
|
form=>{r=>$self->to_json(\%s)}, |
57
|
|
|
|
|
|
|
$callback, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
1; |