class Telecr::Plugins::RateLimit

Overview

RateLimit middleware limits requests based on:

Defined in:

plugins/rate_limit.cr

Constructors

Instance Method Summary

Instance methods inherited from class Telecr::Core::Middleware

call(ctx : Context, next_mw : Context -> ) call

Constructor Detail

def self.new(**options) #

Initialize with custom options

@param options [Hash] Rate limiting configuration @option options [Hash] :global {max: 30, per: 1} Global limit @option options [Hash] :user {max: 5, per: 10} Per-user limit @option options [Hash] :chat {max: 20, per: 60} Per-chat limit


[View source]

Instance Method Detail

def call(ctx : Core::Context, next_mw : Core::Context -> ) #

Main middleware call

@param ctx [Core::Context] Current context @param next_mw [Proc(Core::Context ->)] Next middleware @return [Any] Result from chain


[View source]