Tag: AIOGRAM
Estoy teniendo un problema al usar el threading. Necesito enviar la función Start en un hilo separado. Start función: async def Start(bot, message): await bot.send_message(message.chat.id, 'hola') @dp.message_handler(state=UpdateTime.UpdateTime) async def process_name(message: types.Message, state: FSMContext): if message.text.isdigit(): th = Thread(target= Start, args=(bot, message)) th.start() await state.finish() Error: RuntimeWarning: coroutine 'Start' was never . . . Read more
Estaba escribiendo un bot y estaba lidiando con este problema. ¿Quién sabe cómo arreglarlo? from aiogram import Bot, types from aiogram.dispatcher import Dispatcher from aiogram.types import message from aiogram.utils import executor import os bot = Bot(token=os.getenv(‘TOKEN’)) dp = Dispatcher(bot) @dp.message_handler(commands=[‘start’, ‘help’]) async def commands_start(message: types.Message): await bot.send_message(message.from_user.id, “¡Hola, ¿quién eres?”) . . . Read more
Estoy desarrollando un bot de Telegram utilizando Python 3.9.7 y aiogram 2.16. Al final de mi función, quiero restablecer el estado del usuario sin borrar los datos almacenados. Intenté usar state.finish(), pero este método elimina todos los datos guardados del almacenamiento. Aquí está el código: if user_data.get(“chosen_groups”) == “fired”: # . . . Read more
Tengo un bot de Telegram que maneja mensajes de texto y documentos, y la función que maneja documentos realiza operaciones largas con los mismos. Esto causa el siguiente problema: hasta que el trabajo con el archivo se complete, el bot no continuará manejando mensajes de texto. ¿Existe alguna manera de . . . Read more