SkillAgentSearch skills...

Ratelimiter

A simple-to-use Golang library for gotgbot to rate-limit users and avoid spamming requests to your Telegram bot.

Install / Use

/learn @AnimeKaizoku/Ratelimiter
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

<!-- * * This file is part of ratelimiter-gotgbot (https://github.com/AnimeKaizoku/ratelimiter). * Copyright (c) 2021 ALiwoto, Contributors. * * This library is free: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License License as published by * the Free Software Foundation, version 3. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. -->

<p align="center"> Rate Limiter - gotgbot </p>

<p align="center"> <a href="https://github.com/AnimeKaizoku/ratelimiter"> <img src="./logo.png" alt="ratelimiter-Logo"> </a> </p>

Name: Rate Limiter
Version: v1.0.7
Edit: 2 Feb 2021
By: ALiwoto and Contributors (C)

Go Reference Go-linux Go-macos Go-windows

<hr/>

How to use

import "github.com/AnimeKaizoku/ratelimiter/ratelimiter"


func loadLimiter(d *ext.Dispatcher) {
	limiter = ratelimiter.NewLimiter(d, &ratelimiter.LimiterConfig{
		ConsiderChannel:  false,
		ConsiderUser:     true,
		ConsiderEdits:    false,
		IgnoreMediaGroup: true,
		TextOnly:         false,
		HandlerGroups:    []int{0, 1, 2},
	})

	// 14 messages per 6 seconds
	limiter.SetFloodWaitTime(6 * time.Second)
	limiter.SetMaxMessageCount(14)

	// add sudo users as exceptions, so they don't get rate-limited by library
	limiter.AddExceptionID(sudoUsers...)

	limiter.Start()
}
<hr/>

Helpful links:

Related Skills

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated9mo ago
Forks0

Languages

Go

Security Score

87/100

Audited on Jul 3, 2025

No findings