i = 0
while i < num_clear:
try:
bot.delete_message(m.chat.id, m.message_id - i)
except ExceptionName as e:
print(e)
else:
i += 1
message_out = bot.send_message(...)
file_id = message_out.audio.file_id
Любые костыли готовы рассматривать.
чтобы все сообщения с группы сразу появлялись на сайте
<script async src="https://telegram.org/js/telegram-widget.js?12" data-telegram-post="habrcom/11276" data-width="100%"></script>
возможность регистрации с сайта посредством телеграм авторизации
update => message => reply_to_message => text / message_id
если не существует в базе > добавить
обновляете базу.if user_id in blocklist_db:
return
как можно заставить бота обрабатывать любое сообщение в чате
- /setprivacy
- 'Enable' - your bot will only receive messages that either start with the '/' symbol or mention the bot by username.
'Disable' - your bot will receive all messages that people send to groups.
Current status is: DISABLED
>>> msg = '/cmd ping pong argumenty'
>>> args = msg.split(' ') ## переводим в массив
>>> args
['/cmd', 'ping', 'pong', 'argumenty']
>>> del args[0] ## убираем первый элемент
>>> args = ' '.join(args) ## соединяем обратно
>>> args
'ping pong argumenty'