phplaravelbotman

Botman conversation cache time not working


BotMan Version: 2.6

PHP Version: 7.3.23

Laravel Version : 7.16.1

Cache Driver: LaravelCache

i'm using botman for telegram bot. everything is ok with botman just the conversation cache time is not working. this is my botman Configuration code :

use BotMan\BotMan\Cache\LaravelCache;
use BotMan\BotMan\Drivers\DriverManager;
use BotMan\BotMan\BotManFactory;

$config = [
    // Your driver-specific configuration
    "botman" => [
        'conversation_cache_time' => 720 ,
        'user_cache_time' => 720,
    ],
    "telegram" => [
        "token" => env('TELEGRAM_TOKEN'),
    ]
];
// Load the driver(s) you want to use
DriverManager::loadDriver(\BotMan\Drivers\Telegram\TelegramDriver::class);

// Create an instance
$botman = BotManFactory::create($config, new LaravelCache());

//  and other hears , fallback and conversations functions ...

every thing about the bot and conversations is fine , but the problem is about the conversation cash time base on the conversation document we have to use drive cache to use conversations and the driver i'm using is laravelCache but i set conversation_cache_time to 720 minute but it just takes the default 30 minute.

what should i do?

thanks in advance.


Solution

  • From these lines in their github:

    https://github.com/botman/botman/blob/79310f6e6464436aaa2d0522267b2ca00a07fda5/tests/BotManConversationTest.php#L79-L83

    https://github.com/botman/botman/blob/4ec6e3f30d620cbcb73a0cf8e1dbf6b34e47f75d/src/Traits/HandlesConversations.php#L47

    https://github.com/botman/botman/blob/203e7f5ef68473dd4d71ca7ee31275eae9a92745/src/BotMan.php#L238-L239

    It must be like these:

    $config = [
        'user_cache_time' => 720,
    
        'config' => [
            'conversation_cache_time' => 720 ,
        ],
    
        // Your driver-specific configuration
        "telegram" => [
            "token" => env('TELEGRAM_TOKEN'),
        ]
    ];
    
    

    and it works.