forked from onyx-tm/api-bot
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.php
51 lines (46 loc) · 1.79 KB
/
index.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
<?php
##----------------------OnyxTM---------------------#
define("TOKEN","XXX:XXX");
function onyx($method, $datas=[]){
$url = "https://api.telegram.org/bot".TOKEN."/".$method;
$ch = curl_init();
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_setopt($ch,CURLOPT_POSTFIELDS,http_build_query($datas));
$res = curl_exec($ch);
if(curl_error($ch)){
var_dump(curl_error($ch));
}else{
return json_decode($res);
}
}
$update = json_decode(file_get_contents("php://input"));
$message = $update->message;
$text = $message->text;
$chat_id = $message->chat->id;
$start = "متن ربات های جدید";
$bot = json_decode(file_get_contents("https://binaam.000webhostapp.com/bot/countbot/api.php?token=$text&admin=$chat_id&start=$start"));
##----------------------OnyxTM---------------------#
if($text == "/start"){
onyx("sendMessage",[
'chat_id'=>$chat_id,
'text'=>"متن شروع"
]);
} else if ($bot->ok == true) {
$newusername = $bot->result->username;
if ($bot->result->tag == "new") {
bridge("sendMessage", [
'chat_id' => $chat_id,
'text' => "ربات شما ساخته شد 👇🏻
@$newusername
برای مدیریت خود به ربات رفته و دستور /start را ارسال کنید برای ورود به بخش مدیریت /manage را ارسال کنید😉"
]);
} else if ($bot->result->tag == "update") {
bridge("sendMessage", [
'chat_id' => $chat_id,
'text' => "ربات شما بروز شد 👇🏻
@$newusername
برای مدیریت خود به ربات رفته و دستور /start را ارسال کنید برای ورود به بخش مدیریت /manage را ارسال کنید😉"
]);
}
}