From 1ba0b5d908c724152a39be47d89915ca0bbbd811 Mon Sep 17 00:00:00 2001 From: Denny Dai Date: Sat, 30 May 2015 00:45:47 +0800 Subject: [PATCH] = --- BOT.php | 1 - D-bot | 1 + classes/Telegram/Client.php | 85 ------------------------------------- 3 files changed, 1 insertion(+), 86 deletions(-) create mode 160000 D-bot delete mode 100644 classes/Telegram/Client.php diff --git a/BOT.php b/BOT.php index c28b742..625276c 100644 --- a/BOT.php +++ b/BOT.php @@ -1,7 +1,6 @@ \ No newline at end of file diff --git a/D-bot b/D-bot new file mode 160000 index 0000000..da86cbe --- /dev/null +++ b/D-bot @@ -0,0 +1 @@ +Subproject commit da86cbe130d2da018b2b497d903bb368a2c30966 diff --git a/classes/Telegram/Client.php b/classes/Telegram/Client.php deleted file mode 100644 index 0dd429e..0000000 --- a/classes/Telegram/Client.php +++ /dev/null @@ -1,85 +0,0 @@ -exec('status_online'); - } - - public function setStatusOffline() - { - return $this->exec('status_offline'); - } - - - public function msg($peer, $msg) - { - $peer = $this->escapePeer($peer); - $msg = $this->escapeStringArgument($msg); - return $this->exec('msg ' . $peer . ' ' . $msg); - } - - public function addContact($phoneNumber, $firstName, $lastName) - { - $phoneNumber = preg_replace('%[^0-9]%', '', (string) $phoneNumber); - if (empty($phoneNumber)) { - return false; - } - - return $this->exec('add_contact ' . $phoneNumber . ' ' . $this->escapeStringArgument($firstName) - . ' ' . $this->escapeStringArgument($lastName)); - } - - public function renameContact($contact, $firstName, $lastName) - { - return $this->exec('rename_contact ' . $this->escapePeer($contact) - . ' ' . $this->escapeStringArgument($firstName) . ' ' . $this->escapeStringArgument($lastName)); - } - - public function deleteContact($contact) - { - return $this->exec('del_contact ' . $this->escapePeer($contact)); - } - - public function markRead($peer) - { - return $this->exec('mark_read ' . $this->escapePeer($peer)); - } - - public function getContactList() - { - return explode(PHP_EOL, $this->exec('contact_list')); - } - - public function getUserInfo($user) - { - return $this->exec('user_info ' . $this->escapePeer($user)); - } - - public function getDialogList() - { - return explode(PHP_EOL, $this->exec('dialog_list')); - } - - public function getHistory($peer, $limit = null, $offset = null) - { - if ($limit !== null) { - $limit = (int) $limit; - if ($limit < 1) { //if limit is lesser than 1, telegram-cli crashes - $limit = 1; - } - $limit = ' ' . $limit; - } else { - $limit = ''; - } - if ($offset !== null) { - $offset = ' ' . (int) $offset; - } else { - $offset = ''; - } - - return $this->exec('history ' . $this->escapePeer($peer) . $limit . $offset); - } -}