skip to Main Content

python aiogram how to stop an asynchronous loop – Telegram API

Simple example import asyncio import logging from aiogram import Bot, Dispatcher, types logging.basicConfig(level=logging.INFO) token = 'token' bot = Bot(token=token) dp = Dispatcher(bot=bot) @dp.callback_query_handler(text='stoploop') async def stop_loop(query: types.CallbackQuery): # TODO how to stop test loop? await query.message.edit_text('stop') @dp.callback_query_handler(text='test') async def start_loop(query:…

VIEW QUESTION

lamda funtion in @bot.message_handler() not working properly in telebot python – Telegram API

I tried to implement the following line of code in python script for a telegram bot building using telebot. @bot.message_handler(func=lambda msg:True if msg.text.startswith('/test')) def test_start(message): msg=bot.send_message(message.chat.id,'This feature is under developement') Above code gives me a syntax error. @bot.message_handler(func=lambda msg:True if…

VIEW QUESTION
Back To Top
Search