Longman\TelegramBot\Telegram::processUpdate PHP Méthode

processUpdate() public méthode

Process bot Update request
public processUpdate ( Update $update ) : ServerResponse
$update Longman\TelegramBot\Entities\Update
Résultat Longman\TelegramBot\Entities\ServerResponse
    public function processUpdate(Update $update)
    {
        $this->update = $update;
        //If all else fails, it's a generic message.
        $command = 'genericmessage';
        $update_type = $this->update->getUpdateType();
        if (in_array($update_type, ['inline_query', 'chosen_inline_result', 'callback_query', 'edited_message'], true)) {
            $command = $this->getCommandFromType($update_type);
        } elseif ($update_type === 'message') {
            $message = $this->update->getMessage();
            //Load admin commands
            if ($this->isAdmin()) {
                $this->addCommandsPath(BASE_COMMANDS_PATH . '/AdminCommands', false);
            }
            $this->addCommandsPath(BASE_COMMANDS_PATH . '/UserCommands', false);
            $type = $message->getType();
            if ($type === 'command') {
                $command = $message->getCommand();
            } elseif (in_array($type, ['channel_chat_created', 'delete_chat_photo', 'group_chat_created', 'left_chat_member', 'migrate_from_chat_id', 'migrate_to_chat_id', 'new_chat_member', 'new_chat_photo', 'new_chat_title', 'supergroup_chat_created'], true)) {
                $command = $this->getCommandFromType($type);
            }
        }
        //Make sure we have an up-to-date command list
        //This is necessary to "require" all the necessary command files!
        $this->getCommandsList();
        DB::insertRequest($this->update);
        return $this->executeCommand($command);
    }