mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
polling should leave our world. :)
This commit is contained in:
@ -114,13 +114,4 @@ def chatting(message: types.Message):
|
||||
else:
|
||||
bot.send_message(message.chat.id, 'No one can hear you...')
|
||||
|
||||
# Start retrieving updates
|
||||
# Questions:
|
||||
# 1. Is there any way not to process messages sent earlier?
|
||||
#
|
||||
# For example:
|
||||
# If the bot is turned off, and i tried to type `/find` nothing will happen, but...
|
||||
# When i start the bot, `/find` command will processed, and i will be added to search
|
||||
#
|
||||
# I tried `skip_pending=True`, but thats was not helpful
|
||||
bot.polling()
|
||||
bot.infinity_polling(skip_pending=True)
|
||||
|
@ -30,4 +30,4 @@ def my_chat_m(message: types.ChatMemberUpdated):
|
||||
@bot.message_handler(content_types=util.content_type_service)
|
||||
def delall(message: types.Message):
|
||||
bot.delete_message(message.chat.id,message.message_id)
|
||||
bot.polling(allowed_updates=util.update_types)
|
||||
bot.infinity_polling(allowed_updates=util.update_types)
|
||||
|
@ -9,4 +9,4 @@ def answer_for_admin(message):
|
||||
|
||||
# Register filter
|
||||
bot.add_custom_filter(custom_filters.IsAdminFilter(bot))
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -39,4 +39,4 @@ def bye_user(message):
|
||||
bot.add_custom_filter(MainFilter())
|
||||
bot.add_custom_filter(IsAdmin())
|
||||
|
||||
bot.polling(skip_pending=True,non_stop=True) # Skip old updates
|
||||
bot.infinity_polling(skip_pending=True) # Skip old updates
|
||||
|
@ -13,10 +13,7 @@ def admin_rep(message):
|
||||
def not_admin(message):
|
||||
bot.send_message(message.chat.id, "You are not allowed to use this command")
|
||||
|
||||
|
||||
# Do not forget to register
|
||||
bot.add_custom_filter(custom_filters.ChatFilter())
|
||||
|
||||
|
||||
bot.polling(non_stop=True)
|
||||
|
||||
bot.infinity_polling()
|
||||
|
@ -18,4 +18,4 @@ def text_filter(message):
|
||||
bot.add_custom_filter(custom_filters.IsReplyFilter())
|
||||
bot.add_custom_filter(custom_filters.ForwardFilter())
|
||||
|
||||
bot.polling(non_stop=True)
|
||||
bot.infinity_polling()
|
||||
|
@ -18,4 +18,4 @@ def text_filter(message):
|
||||
bot.add_custom_filter(custom_filters.TextMatchFilter())
|
||||
bot.add_custom_filter(custom_filters.TextStartsFilter())
|
||||
|
||||
bot.polling(non_stop=True)
|
||||
bot.infinity_polling()
|
||||
|
@ -31,4 +31,4 @@ def ready_for_answer(message, state: State):
|
||||
bot.send_message(message.chat.id, "Ready, take a look:\n<b>Name: {name}\nSurname: {surname}\nAge: {age}</b>".format(name=data['name'], surname=data['surname'], age=message.text), parse_mode="html")
|
||||
state.finish(message.chat.id)
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -74,4 +74,4 @@ def send_welcome(message):
|
||||
bot.reply_to(message, reply)
|
||||
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -130,4 +130,4 @@ def command_default(m):
|
||||
bot.send_message(m.chat.id, "I don't understand \"" + m.text + "\"\nMaybe try the help page at /help")
|
||||
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -25,4 +25,4 @@ def echo_message(message):
|
||||
bot.reply_to(message, message.text)
|
||||
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -61,7 +61,7 @@ def default_query(inline_query):
|
||||
|
||||
|
||||
def main_loop():
|
||||
bot.polling(True)
|
||||
bot.infinity_polling()
|
||||
while 1:
|
||||
time.sleep(3)
|
||||
|
||||
|
@ -24,4 +24,4 @@ def callback_query(call):
|
||||
def message_handler(message):
|
||||
bot.send_message(message.chat.id, "Yes/no?", reply_markup=gen_markup())
|
||||
|
||||
bot.polling(none_stop=True)
|
||||
bot.infinity_polling()
|
||||
|
@ -50,4 +50,4 @@ def start(message):
|
||||
bot.send_message(message.chat.id, _('hello'))
|
||||
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -58,4 +58,4 @@ def start(message):
|
||||
bot.send_message(message.chat.id, bot.session['state'])
|
||||
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -78,5 +78,4 @@ def got_payment(message):
|
||||
parse_mode='Markdown')
|
||||
|
||||
|
||||
bot.skip_pending = True
|
||||
bot.polling(none_stop=True, interval=0)
|
||||
bot.infinity_polling(skip_pending = True)
|
||||
|
@ -18,4 +18,4 @@ bot.register_message_handler(start_executor, commands=['start']) # Start command
|
||||
# bot.register_edited_message_handler(*args, **kwargs)
|
||||
# And other functions..
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -10,4 +10,4 @@ def send_welcome(message):
|
||||
def echo_all(message):
|
||||
bot.reply_to(message, message.text)
|
||||
|
||||
bot.polling(skip_pending=True)# Skip pending skips old updates
|
||||
bot.infinity_polling(skip_pending=True)# Skip pending skips old updates
|
||||
|
@ -83,4 +83,4 @@ bot.enable_save_next_step_handlers(delay=2)
|
||||
# WARNING It will work only if enable_save_next_step_handlers was called!
|
||||
bot.load_next_step_handlers()
|
||||
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
@ -81,4 +81,4 @@ def listener(messages):
|
||||
|
||||
|
||||
bot.set_update_listener(listener)
|
||||
bot.polling()
|
||||
bot.infinity_polling()
|
||||
|
Reference in New Issue
Block a user