diff --git a/BOT.php b/BOT.php index 746ab71..ea7a603 100644 --- a/BOT.php +++ b/BOT.php @@ -5,8 +5,6 @@ require_once('functions.php'); $plugins = []; require(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'Base.php'); -$BOT = new DBot\Base('unix:///tmp/tg.sck'); - require_once(PATH.'classes'.DIRECTORY_SEPARATOR.TYPE.DIRECTORY_SEPARATOR.'init.php'); //load plugins diff --git a/classes/Telegram-Bot/Base.php b/classes/Telegram-Bot/Base.php new file mode 100644 index 0000000..8e7b5a9 --- /dev/null +++ b/classes/Telegram-Bot/Base.php @@ -0,0 +1,26 @@ + array ( + 'method' => 'POST', + 'header' => "Content-type: application/x-www-form-urlencoded", + 'content' => http_build_query($data) + ) + ); + $context = stream_context_create($opts); + } + return file_get_contents(TB_API_URL.$command, false, $context); + } + public function msg($id, $msg) + { + return $this->exec('sendMessage', array('chat_id' => $id, 'text' => $msg)); + } +} + diff --git a/classes/Telegram-Bot/init.php b/classes/Telegram-Bot/init.php new file mode 100644 index 0000000..cae12db --- /dev/null +++ b/classes/Telegram-Bot/init.php @@ -0,0 +1,14 @@ + 0) { + $isgroup = false; +}else{ + $isgroup = true; +} +//reply to... + + $from = $GET['message']['chat']['id']; + $text = $GET['message']['text']; \ No newline at end of file diff --git a/classes/Telegram/init.php b/classes/Telegram/init.php index 3e4b1e6..ade1636 100644 --- a/classes/Telegram/init.php +++ b/classes/Telegram/init.php @@ -1,5 +1,5 @@