How to mute a user for a minute if they spam the bot in Telegram?
📁 function, Advanced Python Topics, Error, requests
I made my Telegram bot with fairly simple functions. The problem is that literally one person can take it down by simply spamming one or several commands, and the error is thrown by TelegramAPI itself.
Here's the error: ERROR - TeleBot: ""A request to the Telegram API was unsuccessful. Error code: 429 Description: Too Many Requests: retry after 13""
I would like that a user who, for example, sends 10 messages in a short period of time gets muted for a minute and receives a message like ""ha-ha caught a spammer"".
The bot is written in Python using telebot (or pyTelegramBotAPI), and everything is running on Heroku.
You can send a message using:
POST /v2/conversations/8:alice/activities HTTP/1.1Host: apis.skype.comAuthorization: Bearer <redacted oauth2 token>{ ""message"": {""content"" : ""Hi! (wave)""}}for example to send a message string to a skypeid user in Python:
#!/usr/bin/env python2import jsonfrom urllib2 import urlopen, Requestdef send_message(message, skypeid, token, host= Log in to leave an answer