Giter VIP home page Giter VIP logo

Comments (9)

MBoretto avatar MBoretto commented on May 10, 2024

are you using 0.11?

from core.

abc0707 avatar abc0707 commented on May 10, 2024

Hello MBoretto,
I tried composer install require... then I got that problem
then I tried composer updatte .... problem solved :)

Thanks

from core.

abc0707 avatar abc0707 commented on May 10, 2024

yeah... seem like 0.1.1 has problem (composer install), when i tried 0.0.7 (clone from git), it works just fine.
I still receive: PHP Fatal error: Call to a member function isEnabled() on a non-object in after using 0.1.1

from core.

Doranku avatar Doranku commented on May 10, 2024

Issue is not related to nginx and still persists in 0.12

from core.

abc0707 avatar abc0707 commented on May 10, 2024

confirmed... I tried with apache, still have this problem
On Aug 8, 2015 11:10 PM, "Doranku" [email protected] wrote:

Issue is not related to nginx and still persists in 0.12


Reply to this email directly or view it on GitHub
#19 (comment)
.

from core.

Doranku avatar Doranku commented on May 10, 2024

The problem there is a non object in the getCommandsLists ('leftchatparticipant' => false)

To prevent this from having a working bot, the symptom can be avoided with following patch.

--- a/src/Commands/HelpCommand.php
+++ b/src/Commands/HelpCommand.php
@@ -37,6 +37,10 @@ class HelpCommand extends Command
             $msg = 'GeoBot v. ' . $this->telegram->getVersion() . "\n\n";
             $msg .= 'Commands List:' . "\n";
             foreach ($commands as $command) {
+               if(!is_object($command))
+               {
+                       continue;
+               }
                 if (!$command->isEnabled()) {
                     continue;
                 }

Or by removing src/Commands/LeftChatParticipantCommand.php. But the real solve is having the getCommandsList method in Telegram check whether the getCommandClass returned a Command object.

from core.

MBoretto avatar MBoretto commented on May 10, 2024

I've pull a commit that fix the help command. Just wait the merge or get
the code from my repository.
On 8 Aug 2015 20:45, "Doranku" [email protected] wrote:

The problem there is a non object in the getCommandsLists
('leftchatparticipant' => false)

To prevent this from having a working bot, the symptom can be avoided with
following patch.

--- a/src/Commands/HelpCommand.php
+++ b/src/Commands/HelpCommand.php
@@ -37,6 +37,10 @@ class HelpCommand extends Command
$msg = 'GeoBot v. ' . $this->telegram->getVersion() . "\n\n";
$msg .= 'Commands List:' . "\n";
foreach ($commands as $command) {

  •           if(!is_object($command))
    
  •           {
    
  •                   continue;
    
  •           }
             if (!$command->isEnabled()) {
                 continue;
             }
    

Or by removing src/Commands/LeftChatParticipantCommand.php. But the real
solve is having the getCommandsList method in Telegram check whether the
getCommandClass returned a Command object.


Reply to this email directly or view it on GitHub
#19 (comment)
.

from core.

Doranku avatar Doranku commented on May 10, 2024

That is a "lazy way" patch :)
I meant fix the source of the problem:

--- a/src/Telegram.php
+++ b/src/Telegram.php
@@ -193,6 +193,10 @@ class Telegram
             if (substr($name, -11, 11) === 'Command.php') {
                 $name = strtolower(str_replace('Command.php', '', $name));
                 $commands[$name] = $this->getCommandClass($name);
+               if(!($commands[$name] instanceof \Longman\TelegramBot\Command))
+               {
+                       unset($commands[$name]);
+               }
             }
         }

@@ -209,7 +213,11 @@ class Telegram
                     $name = $fileInfo->getFilename();
                     if (substr($name, -11, 11) === 'Command.php') {
                         $name = strtolower(str_replace('Command.php', '', $name));
                         $commands[$name] = $this->getCommandClass($name);
+                       if(!($commands[$name] instanceof \Longman\TelegramBot\Command))
+                       {
+                               unset($commands[$name]);
+                       }
                     }
                 }
             }

from core.

MBoretto avatar MBoretto commented on May 10, 2024

Commits has been merged

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.