class
Telecr::Plugins::RateLimit
- Telecr::Plugins::RateLimit
- Telecr::Core::Middleware
- Reference
- Object
Overview
RateLimit middleware limits requests based on:
- Global: overall bot usage
- Per-user: individual user limits
- Per-chat: per group/channel limits
Defined in:
plugins/rate_limit.crConstructors
-
.new(**options)
Initialize with custom options
Instance Method Summary
-
#call(ctx : Core::Context, next_mw : Core::Context -> )
Main middleware call
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
Instance Method Detail
Main middleware call
@param ctx [Core::Context] Current context @param next_mw [Proc(Core::Context ->)] Next middleware @return [Any] Result from chain