mirror of
https://github.com/eternnoir/pyTelegramBotAPI.git
synced 2023-08-10 21:12:57 +03:00
Asyncio.run back
This commit is contained in:
@ -84,4 +84,5 @@ async def back_callback(call: types.CallbackQuery):
|
||||
|
||||
|
||||
bot.add_custom_filter(ProductsCallbackFilter())
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -8,4 +8,5 @@ async def make_some(message: telebot.types.ChatJoinRequest):
|
||||
await bot.send_message(message.chat.id, 'I accepted a new user!')
|
||||
await bot.approve_chat_join_request(message.chat.id, message.from_user.id)
|
||||
|
||||
bot.polling(skip_pending=True)
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
@ -30,4 +30,5 @@ async def my_chat_m(message: types.ChatMemberUpdated):
|
||||
@bot.message_handler(content_types=util.content_type_service)
|
||||
async def delall(message: types.Message):
|
||||
await bot.delete_message(message.chat.id,message.message_id)
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -1,6 +1,6 @@
|
||||
from telebot.async_telebot import AsyncTeleBot
|
||||
from telebot import asyncio_filters
|
||||
bot = AsyncTeleBot('TOKEN')
|
||||
bot = AsyncTeleBot('1297441208:AAGiez5xhzai5russPtPKmZjbdjybW4T0U8')
|
||||
|
||||
# Handler
|
||||
@bot.message_handler(chat_types=['supergroup'], is_chat_admin=True)
|
||||
@ -9,4 +9,6 @@ async def answer_for_admin(message):
|
||||
|
||||
# Register filter
|
||||
bot.add_custom_filter(asyncio_filters.IsAdminFilter(bot))
|
||||
bot.polling()
|
||||
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -40,4 +40,5 @@ async def bye_user(message):
|
||||
bot.add_custom_filter(MainFilter())
|
||||
bot.add_custom_filter(IsAdmin())
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -14,4 +14,5 @@ async def not_admin(message):
|
||||
|
||||
# Do not forget to register
|
||||
bot.add_custom_filter(telebot.asyncio_filters.ChatFilter())
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -19,4 +19,5 @@ async def text_filter(message):
|
||||
bot.add_custom_filter(telebot.asyncio_filters.IsReplyFilter())
|
||||
bot.add_custom_filter(telebot.asyncio_filters.ForwardFilter())
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -17,4 +17,5 @@ async def text_filter(message):
|
||||
bot.add_custom_filter(telebot.asyncio_filters.TextMatchFilter())
|
||||
bot.add_custom_filter(telebot.asyncio_filters.TextStartsFilter())
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -71,4 +71,5 @@ bot.add_custom_filter(asyncio_filters.IsDigitFilter())
|
||||
# set saving states into file.
|
||||
bot.enable_saving_states() # you can delete this if you do not need to save states
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
@ -17,4 +17,5 @@ async def new_message(message: telebot.types.Message):
|
||||
await bot.edit_message_text(chat_id=message.chat.id, message_id=result_message.id, text='<i>Done!</i>', parse_mode='HTML')
|
||||
|
||||
|
||||
bot.polling(skip_pending=True)
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -23,4 +23,5 @@ async def echo_message(message):
|
||||
await bot.reply_to(message, message.text)
|
||||
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -24,4 +24,5 @@ async def photo_send(message: telebot.types.Message):
|
||||
|
||||
|
||||
|
||||
bot.polling(skip_pending=True)
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -36,4 +36,5 @@ bot.setup_middleware(SimpleMiddleware(2))
|
||||
async def start(message):
|
||||
await bot.send_message(message.chat.id, 'Hello!')
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
@ -45,4 +45,5 @@ async def start(message, data: dict):
|
||||
await bot.send_message(message.chat.id, data['response'])
|
||||
|
||||
|
||||
bot.polling()
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -15,4 +15,6 @@ bot.register_message_handler(start_executor, commands=['start']) # Start command
|
||||
# bot.register_edited_message_handler(*args, **kwargs)
|
||||
# And other functions..
|
||||
|
||||
bot.polling(skip_pending=True)
|
||||
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -24,4 +24,6 @@ async def photos_send(message: telebot.types.Message):
|
||||
|
||||
|
||||
|
||||
bot.polling(skip_pending=True)
|
||||
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
||||
|
@ -10,4 +10,6 @@ async def send_welcome(message):
|
||||
async def echo_all(message):
|
||||
await bot.reply_to(message, message.text)
|
||||
|
||||
bot.polling(skip_pending=True)# Skip pending skips old updates
|
||||
|
||||
import asyncio
|
||||
asyncio.run(bot.polling(skip_pending=True)) # to skip updates
|
||||
|
@ -11,4 +11,6 @@ async def update_listener(messages):
|
||||
|
||||
bot.set_update_listener(update_listener)
|
||||
|
||||
bot.polling()
|
||||
|
||||
import asyncio
|
||||
asyncio.run(bot.polling())
|
Reference in New Issue
Block a user