-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbot.php
More file actions
60 lines (44 loc) · 1.43 KB
/
bot.php
File metadata and controls
60 lines (44 loc) · 1.43 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
<?php
/*
* By Mahmood Abbas
* Telegram @ox_9n
*/
include("telegram.php");
$bot_id = "BOT_Token";
$api_key = "e496e314e83fd43e"
$telegram = new Telegram($bot_id);
$result = $telegram->getData();
$text = $result["message"] ["text"];
$chat_id = $telegram->ChatID();
//Get the file
if (strpos($text, '/url') !== false) {
$wait = array('chat_id' => $chat_id, 'text' => "Wait Please............");
$telegram->sendMessage($wait);
$ctext = str_replace("/url ","",$text);
$json = file_get_contents('http://api.page2images.com/restfullink?p2i_url='.$ctext.'&p2i_key='.$api_key);
sleep(10);
$obj = json_decode($json);
$content = file_get_contents("$obj->image_url");
//Store in the filesystem.
$fp = fopen("image.jpg", "w");
fwrite($fp, $content);
fclose($fp);
if(isset($obj->image_url)){
$img = curl_file_create('image.jpg','image/png');
$content = array('chat_id' => $chat_id, 'photo' => $img );
$telegram->sendPhoto($content);
}else{
$error = array('chat_id' => $chat_id, 'text' => "Error Something wrong!");
$telegram->sendMessage($error);
}
}elseif($text === "/start"){
$d = array('chat_id' => $chat_id, 'text' => "Welcome To TakeShotBot Bot By @ox_9n");
$telegram->sendMessage($d);
}elseif($text === "/dev"){
$d = array('chat_id' => $chat_id, 'text' => "@DevMah");
$telegram->sendMessage($d);
}else{
$s = array('chat_id' => $chat_id, 'text' => "Send /url + weburl to get screenshot for it");
$telegram->sendMessage($s);
}
?>