-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtelebot.php
More file actions
243 lines (242 loc) · 8.14 KB
/
telebot.php
File metadata and controls
243 lines (242 loc) · 8.14 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
<?php
include("Telegram.php");
$find_hitlers = array(
"гитлер",
"рейх",
"зига",
"hitler",
"1488",
"рейх",
"жечь евреев",
"жги евреев",
"холокост"
);
$find_boobs = array(
"сиськи",
"сисек",
"сисечки",
"сисяндры",
"сисюли",
"/boobs",
"/boobs@Turn_Bot"
);
$find_butts = array(
"жопа",
"попа",
"попка",
"жопка",
"жопо",
"жопунька"
);
$bot_id = "";
$yandtrankey = "";
$openwethid = "";
$telegram = new Telegram($bot_id);
$text = $telegram->Text();
$mb_text = mb_strtolower($text, 'utf-8');
$chat_id = $telegram->ChatID();
function checkArr($arr)
{
$check = array_filter($arr, function($k)
{
global $mb_text;
return mb_stripos($mb_text, $k) !== false;
});
return count($check) > 0;
}
// Помощь
if ($text == "/help" OR $text == "/help@Turn_Bot") {
$reply = " /help - список команд
/bash - шуткануть с баша
/cur - погрустить с курсом
/news - 5 свежих новостей с медузы
/tr - яндекс.переводчик. Жми команду для помощи.
/we - погода. Жми команду для помощи.
/advice - спросить совета (кд 1 мин)
/cat - котик";
$content = array(
'chat_id' => $chat_id,
'text' => $reply
);
$telegram->sendMessage($content);
}
// Шутки с баша
if ($text == "/bash" OR $text == "/bash@Turn_Bot") {
$html = file_get_contents('http://bash.im/forweb/?u');
$sim = array(
"document.write(borq);",
"var borq='';",
"borq +=",
""",
"<' + 'br>"
);
$rep = array(
"",
"",
"",
"'",
"\n"
);
$html = explode(' ]', substr(strip_tags(str_replace($sim, $rep, $html), '\n'), 4, -30));
$content = array(
'chat_id' => $chat_id,
'text' => html_entity_decode($html[1])
);
$telegram->sendMessage($content);
}
//Курс валюты
if ($text == "/cur" OR $text == "/cur@Turn_Bot") {
$cur = simplexml_load_file("http://www.cbr.ru/scripts/XML_daily.asp?");
$usd = $cur->Valute[10]->Name . " " . $cur->Valute[10]->Value;
$eur = $cur->Valute[11]->Name . " " . $cur->Valute[11]->Value;
$pln = $cur->Valute[19]->Name . " " . $cur->Valute[19]->Value;
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $usd . "\n" . $eur . "\n" . $pln
));
}
//Новости
if ($text == "/news" OR $text == "/news@Turn_Bot") {
$rss = simplexml_load_file("https://meduza.io/rss/all");
$result = '';
for ($i = 0; $i < 6; $i++) {
$title = $rss->channel->item[$i]->title;
$link = $rss->channel->item[$i]->link;
$result .= $i . ") [" . trim($title) . "](" . $link . ")\n";
}
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $result,
'parse_mode' => 'Markdown',
'disable_web_page_preview' => 'true'
));
}
//Гитлер и все, что к нему относится
$hitlers = array(
'CAADAgADTAIAAiHtuwM0w5oWdrwUsAI',
'BQADAgADPgIAAiHtuwPNMjQkRQEERwI',
'BQADAgADMgIAAiHtuwO7d0YhJHL79AI',
'BQADAgAD1wMAAiHtuwOg8Q_qBaHrbAI',
'BQADAgAD5wMAAiHtuwN2AAFEAsKmcN4C',
'BQADAgADRAIAAiHtuwM4RQnJhcQXrwI',
'BQADBAADsAADcKvVBCcMLL-Z2FfrAg',
'BQADAgADLAIAAiHtuwPRAt2H7R4JbQI',
'BQADAgADMAIAAiHtuwOdxr-cmmlPLwI',
'BQADAgADSAIAAiHtuwO8cAJFZVDO6wI',
'CAADAgADLAIAAiHtuwPRAt2H7R4JbQI',
'CAADAgADLgIAAiHtuwNdwzbZsxYrtAI',
'CAADAgADMAIAAiHtuwOdxr-cmmlPLwI',
'CAADAgADMgIAAiHtuwO7d0YhJHL79AI',
'CAADAgADNAIAAiHtuwOrFz1Ys75vngI',
'CAADAgADOAIAAiHtuwMs7mMiyp_LGQI',
'CAADAgADPgIAAiHtuwPNMjQkRQEERwI',
'CAADAgADQAIAAiHtuwPJ8ab-ioHcXQI',
'CAADAgADRAIAAiHtuwM4RQnJhcQXrwI',
'CAADAgADSAIAAiHtuwO8cAJFZVDO6wI',
'CAADAgADTgIAAiHtuwPIk696OrWIhgI',
'CAADAgADxQMAAiHtuwMNjB9tfln8QwI',
'CAADAgADxwMAAiHtuwMfIaXCl3_ZSQI',
'CAADAgADyQMAAiHtuwOUVmQX3cuc9wI',
'CAADAgADzQMAAiHtuwMwC3wxDSKU3QI',
'CAADAgADzwMAAiHtuwPIImB34jFF6wI',
'CAADAgAD0wMAAiHtuwMjoZFV2xiQIwI',
'CAADAgAD2QMAAiHtuwNSSISIiiunBgI',
'CAADAgAD2wMAAiHtuwMMX7zpS7REfQI',
'CAADAgAD3QMAAiHtuwPI0dsWzZZDEQI',
'CAADAgAD3wMAAiHtuwMly8RQMXZLCgI',
'CAADAgAD4QMAAiHtuwOb2b3uZxbBVgI',
'CAADAgAD5wMAAiHtuwN2AAFEAsKmcN4C',
'CAADAgAD6QMAAiHtuwP_7MG90BPVGwI'
);
if (checkArr($find_hitlers) === true) {
$content = array(
'chat_id' => $chat_id,
'sticker' => $hitlers[rand(0, 33)]
);
$telegram->sendSticker($content);
}
//Переводчик
$trpos = mb_stripos($text, "/tr");
if ($trpos !== false) {
$text = explode(' ', $text);
$lang = $text[1];
$text = urlencode(join(' ', array_slice($text, 2)));
$url = "https://translate.yandex.net/api/v1.5/tr.json/translate?key=" . $yandtrankey . "&text=" . $text . "&lang=" . $lang;
$data = json_decode(file_get_contents($url));
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $data->text[0]
));
}
// Хелп по переводчику
if ($text == "/tr" OR $text == "/tr@Turn_Bot") {
$reply = "Помощь по переводчику.\n/tr [язык] [текст]\nЯзык на вотороый хотим перевести, исходный определяется автоматически.\n";
$reply .= "Пример - /tr ru hello\n[Список языков](https://tech.yandex.ru/translate/doc/dg/concepts/api-overview-docpage/)";
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $reply,
'parse_mode' => 'Markdown',
'disable_web_page_preview' => 'true'
));
}
// Советы
if ($text == "/advice" OR $text == "/advice@Turn_Bot") {
$data = json_decode(file_get_contents("http://fucking-great-advice.ru/api/random"));
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => html_entity_decode($data->text)
));
}
//Котик
if ($text == "/cat" OR $text == "/cat@Turn_Bot") {
$rss = simplexml_load_file("http://thecatapi.com/api/images/get?format=xml");
$reply = (get_headers($rss->data->images->image->url) !== false) ? $rss->data->images->image->url : "Котик сдох. Попробуй еще раз.";
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $reply
));
}
// Сиськи
if (checkArr($find_boobs) === true) {
$data = json_decode(file_get_contents("http://api.oboobs.ru/boobs/1/1/random/"));
$telegram->sendPhoto(array(
'chat_id' => $chat_id,
'photo' => "http://media.oboobs.ru/" . $data[0]->preview
));
}
// Жопки
if (checkArr($find_butts) === true) {
$data = json_decode(file_get_contents("http://api.obutts.ru/butts/1/1/random/"));
$telegram->sendPhoto(array(
'chat_id' => $chat_id,
'photo' => "http://media.obutts.ru/" . $data[0]->preview
));
}
//Погода
$wepos = mb_stripos($text, "/we ");
if ($wepos !== false) {
$city = mb_strimwidth($text, 4, 500);
$url = "http://api.openweathermap.org/data/2.5/weather?q=" . $city . "&lang=ru&units=metric&APPID=" . $openwethid;
$data = json_decode(file_get_contents($url));
$pressure = $data->main->pressure * 0.750064;
$reply = $data->weather[0]->description . "\n";
$reply .= "Температура: " . $data->main->temp . "°C\n";
$reply .= "Давление: " . $pressure . "рт/ст\n";
$reply .= "Влажность: " . $data->main->humidity . "%\n";
$telegram->sendMessage(array(
'chat_id' => $chat_id,
'text' => $reply
));
}
// Хелп по погоде
if ($text == "/we" OR $text == "/we@Turn_Bot") {
$reply = "Для тех, кому лень идти до окна.\n/we [город]\nПример - /we Калининград";
$content = array(
'chat_id' => $chat_id,
'text' => $reply,
'parse_mode' => 'Markdown',
'disable_web_page_preview' => 'true'
);
$telegram->sendMessage($content);
}
?>