Skip to content

Problem with rate limit logic #64

@mobinjavari

Description

@mobinjavari

Rate Limiting

$bot = new Nutgram('your-token-here');
$bot->throttle(4);

$bot->onCommand('start', StartCommand::class); // 4 messages per minute
$bot->onCommand('help', HelpCommand::class)->throttle(2); // 2 messages per minute

$bot->group(function (Nutgram $bot) {

    $bot->onCommand('feedback', FeedbackCommand::class); // 3 messages per minute
    $bot->onCommand('stats', StatsCommand::class)->throttle(2); // 2 messages per minute
    $bot->onCommand('what', WhatCommand::class)->throttle(5); // 5 messages per minute

    $bot->group(function (Nutgram $bot) {
    
        $bot->onCommand('settings', SettingsCommand::class); // ???? messages per minute
        $bot->onCommand('donate', DonateCommand::class)->throttle(1); // 1 message per minute
        $bot->onCommand('refund', RefundCommand::class)->throttle(3); // 3 messages per minute
        
    }) // Delete ->throttle(2);
    
})->throttle(3);

What number is placed in place of the commented question mark in the code above?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions