D
D
DexPro2020-03-26 14:11:43
Python
DexPro, 2020-03-26 14:11:43

A bot that checks a URL, redirects it, and blocks it for a certain amount of time?

I am writing a telegram bot. Python. There was a difficulty with the implementation of the following. When a user sends a link to the bot that starts with https://www.google.com/..., then the bot redirects this link to the group (or me), after, within 7 days, nothing from this user to the group (or me) not redirected.
Here is a simple code to send a message to a group:

@bot.message_handler(content_types=["text"])
def URL(message):
bot.send_message(GroupID, '%s ' % message.chat.username + '(ID:' + str(message.chat.id) + '): ' + message.text)
bot.send_message(message.chat.id, 'Ваша ссылка отправлена! Следующую ссылку Вы можете отправить через 7 дней')

GroupID - Group (channel) ID or user ID. What will be the condition for checking the link when sending to the group?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-03-26
@dimonchik2013

instead of message.text you insert checked_text
and in the new function above you carry out all the calculations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question