Browse Source

update telegram sdk.

干净 4 years ago
parent
commit
2db4956d92

+ 2 - 2
composer.json

@@ -10,7 +10,7 @@
         "firebase/php-jwt": "~3.0",
         "illuminate/database": "6.*",
         "illuminate/pagination": "6.*",
-        "irazasyed/telegram-bot-sdk": "^2.0",
+        "irazasyed/telegram-bot-sdk": "^3.4.1",
         "khanamiryan/qrcode-detector-decoder": "*",
         "league/omnipay": "^3",
         "lokielse/omnipay-alipay": "*",
@@ -36,4 +36,4 @@
         "sort-packages": true,
         "optimize-autoloader": true
     }
-}
+}

+ 1 - 1
src/Utils/Telegram/Commands/CheckinCommand.php

@@ -25,7 +25,7 @@ class CheckinCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();

+ 1 - 1
src/Utils/Telegram/Commands/HelpCommand.php

@@ -25,7 +25,7 @@ class HelpCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update  = $this->getUpdate();
         $Message = $Update->getMessage();

+ 1 - 1
src/Utils/Telegram/Commands/InfoCommand.php

@@ -26,7 +26,7 @@ class InfoCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update  = $this->getUpdate();
         $Message = $Update->getMessage();

+ 1 - 1
src/Utils/Telegram/Commands/MenuCommand.php

@@ -24,7 +24,7 @@ class MenuCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update  = $this->getUpdate();
         $Message = $Update->getMessage();

+ 2 - 2
src/Utils/Telegram/Commands/MyCommand.php

@@ -27,7 +27,7 @@ class MyCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();
@@ -75,7 +75,7 @@ class MyCommand extends Command
                 $response = $this->triggerCommand('menu');
             } else {
                 // 群组
-                $response = self::Group($User, $SendUser, $ChatID, $Message, $MessageID);
+                $response = $this->Group($User, $SendUser, $ChatID, $Message, $MessageID);
             }
         }
 

+ 1 - 1
src/Utils/Telegram/Commands/PingCommand.php

@@ -24,7 +24,7 @@ class PingCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();

+ 4 - 4
src/Utils/Telegram/Commands/SetuserCommand.php

@@ -26,7 +26,7 @@ class SetuserCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();
@@ -64,14 +64,14 @@ class SetuserCommand extends Command
         // 发送 '输入中' 会话状态
         $this->replyWithChatAction(['action' => Actions::TYPING]);
 
-        return self::Reply($arguments, $SendUser, $Message, $MessageID, $ChatID);
+        return $this->Reply($SendUser, $Message, $MessageID, $ChatID);
     }
 
-    public function Reply($arguments, $SendUser, $Message, $MessageID, $ChatID)
+    public function Reply($SendUser, $Message, $MessageID, $ChatID)
     {
         $User = null;
         $FindUser = null;
-        $arguments = trim($arguments);
+        $arguments = implode(' ', array_splice(explode(' ', trim($Message->getText())), 1));
 
         if ($Message->getReplyToMessage() != null) {
             // 回复源消息用户

+ 2 - 2
src/Utils/Telegram/Commands/StartCommand.php

@@ -26,7 +26,7 @@ class StartCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();
@@ -47,7 +47,7 @@ class StartCommand extends Command
                 'username' => $Message->getFrom()->getUsername(),
             ];
             // 消息内容
-            $MessageText = trim($arguments);
+            $MessageText = implode(' ', array_splice(explode(' ', trim($Message->getText())), 1));
             if (
                 $MessageText != ''
                 && TelegramTools::getUser($SendUser['id']) == null

+ 3 - 3
src/Utils/Telegram/Commands/UnbindCommand.php

@@ -26,7 +26,7 @@ class UnbindCommand extends Command
     /**
      * {@inheritdoc}
      */
-    public function handle($arguments)
+    public function handle()
     {
         $Update = $this->getUpdate();
         $Message = $Update->getMessage();
@@ -64,7 +64,7 @@ class UnbindCommand extends Command
             }
 
             // 消息内容
-            $MessageText = trim($arguments);
+            $MessageText = implode(' ', array_splice(explode(' ', trim($Message->getText())), 1));
 
             if ($MessageText == $User->email) {
                 $temp = $User->TelegramReset();
@@ -79,7 +79,7 @@ class UnbindCommand extends Command
                 return;
             }
 
-            $text = self::sendtext();
+            $text = $this->sendtext();
             if ($MessageText != '') {
                 $text = '键入的 Email 地址与您的账户不匹配.';
             }