-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmutato.php
75 lines (71 loc) · 2.36 KB
/
mutato.php
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
if(substr($msg,0,7)=='/mutato' && $isadmin){
if(strlen($msg) == 7) str_replace('/mutato','',$msg);
else str_replace('/mutato ','',$msg);
$ban = array();
$s = explode(' ',$msg);
if($rid && (!strpos(' '.$s[0],'@') && !is_int($s[0]))){
$reason = $msg;
$ban = array('id' => $rid, 'username' => get($rid)[username], 'reason' => $reason);
goto mut;}
if(strpos(' '.$s[0],'@') && !is_int($s[0])){
$reason = str_replace($s[0],'',$msg);
$ban = array('id' => get($s[0])[user_id], 'username' => get($s[0])[username], 'reason' => $reason);
goto mut;}
if(is_int($s[0])){
$reason = str_replace($s[0],'',$msg);
$ban = array('id' => $s[0], 'username' => get($s[0])[username], 'reason' => $reason);
goto mut;}
if($entities){
$type = $entities[0][type];
$id = $entities[0][user][id];
$end = $entities[0][offset]+$entities[0][lenght]-5;
if($id && $type == 'text_mention'){
$reason = substr($msg, 0, $end);
$ban = array('id' => $id, 'username' => get($id)[username], 'reason' => $reason);
}
}
mut:
if(!isadmin($ban[id])){
update($utab, "set mutato='1' where chat_id='$chatID' and user_id='$ban[id]'");
if($r[ok]){
$reason = '<b>per '.$ban[reason].'</b>';
sm($chatID, 'Ho mutato '.$ban[username]."[$ban[id]]");
}
}
}
if(substr($msg,0,9)=='/unmutato' && $isadmin){
if(strlen($msg) == 9) str_replace('/unmutato','',$msg);
else str_replace('/unmutato ','',$msg);
$ban = array();
$s = explode(' ',$msg);
if($rid && (!strpos(' '.$s[0],'@') && !is_int($s[0]))){
$reason = $msg;
$ban = array('id' => $rid, 'username' => get($rid)[username], 'reason' => $reason);
goto unmut;}
if(strpos(' '.$s[0],'@') && !is_int($s[0])){
$reason = str_replace($s[0],'',$msg);
$ban = array('id' => get($s[0])[user_id], 'username' => get($s[0])[username], 'reason' => $reason);
goto unmut;}
if(is_int($s[0])){
$reason = str_replace($s[0],'',$msg);
$ban = array('id' => $s[0], 'username' => get($s[0])[username], 'reason' => $reason);
goto unmut;}
if($entities){
$type = $entities[0][type];
$id = $entities[0][user][id];
$end = $entities[0][offset]+$entities[0][lenght]-5;
if($id && $type == 'text_mention'){
$reason = substr($msg, 0, $end);
$ban = array('id' => $id, 'username' => get($id)[username], 'reason' => $reason);
}
}
unmut:
if(!isadmin($ban[id])){
update($utab, "set mutato='0' where chat_id='$chatID' and user_id='$ban[id]'");
if($r[ok]){
$reason = '<b>per '.$ban[reason].'</b>';
sm($chatID, 'Ho smutato '.$ban[username]."[$ban[id]]");
}
}
}