-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathgruppi.php
More file actions
129 lines (98 loc) · 2.24 KB
/
gruppi.php
File metadata and controls
129 lines (98 loc) · 2.24 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/*
PLUGIN GRUPPI
Versione 3.0
*/
echo "<br>Plugin Gruppi: 3.0";
$replyID = $update["message"]["reply_to_message"]["from"]["id"];
$replyNome = $update["message"]["reply_to_message"]["from"]["first_name"];
//lasciare questo codice immutato
$args = array(
'chat_id' => $chatID
);
$add = new HttpRequest("get", "https://api.telegram.org/$api/getChatAdministrators", $args);
$ris = $add->getResponse();
$admins = json_decode($ris, true);
foreach($admins['result'] as $adminsa)
{
if($adminsa['user']['id'] == $userID)
$isadmin = true;
if($adminsa["user"]["id"] == $userID and $adminsa["status"]=="creator")
$isfounder=true;
}
/*
Nelle condizioni if sarà possibile mettere
$isadmin per verificare che solo gli Admin
possano usare tale comando.
esempio
if(strpos(....) and $isadmin)
{
sm();
//altri comandi
}
*/
//lista Admin
if(strpos(" ".$msg, "/admins"))
{
$shish = "Admin:";
foreach($admins[result] as $ala)
{
if($ala[status] == "creator")
{
$shish .= "
@".$ala[user][username]." [FONDATORE]";
}else{
$shish .= "
@".$ala[user][username];
}
}
sm($chatID, $shish);
}
if($update["message"]["new_chat_member"])
{
$nome = $update["message"]["new_chat_member"]["first_name"];
$username = $update["message"]["new_chat_member"]["username"];
$id = $update["message"]["new_chat_member"]["id"];
$text = "Ciao $nome @$username $id, benvenuto nel gruppo. Per vedere le regole premi /regole";
sm($chatID, $text);
}
if($update["message"]["left_chat_member"])
{
$nome = $update["message"]["left_chat_member"]["first_name"];
$username = $update["message"]["left_chat_member"]["username"];
$id = $update["message"]["left_chat_member"]["id"];
$text = "Arrivederci $nome @$username $id.";
sm($chatID, $text);
}
if($update["message"]["new_chat_title"])
{
$nuovo_nome = $update["message"]["new_chat_title"];
$text = "Nuovo nome gruppo: $nuovo_nome";
sm($chatID, $text);
}
if(strpos($msg, "/ban")===0 and $isadmin)
{
if($replyID)
{
sm($chatID, "Ho bannato $replyNome.");
ban($chatID, $replyID);
}
}
if(strpos($msg, "/kick")===0 and $isadmin)
{
if($replyID)
{
sm($chatID, "Ho kickato $replyNome.");
ban($chatID, $replyID);
unban($chatID, $replyID);
}
}
if(strpos($msg, "/unban")===0 and $isadmin)
{
if($replyID)
{
sm($chatID, "Ho sbannato $replyNome.");
unban($chatID, $replyID);
}
}
?>