m
Size: a a a
m
AR
AR
m
AR
AR
OA
BE
AR
def keyboard(board, **kwargs):
'''
Получить разметку для клавиатуры aiogram из двумерного списка.
'''
board = [[KeyboardButton(button) for button in row] for row in board]
return ReplyKeyboardMarkup(board, *kwargs)
AR
**
AR
m
m
m
Task exception was never retrieved
future: <Task finished coro=<Dispatcher._process_pooling_updates() done, defined at /home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py:208> exception=TypeError('An asyncio.Future, a coroutine or an awaitable is required',)>
Traceback (most recent call last):
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 215, in _process_pooling_updates
for response in await self.process_updates(updates):
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 103, in process_updates
return await asyncio.gather(*tasks)
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 120, in process_update
return await self.message_handlers.notify(update.message)
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/handler.py", line 42, in notify
response = await handler(*args, **kwargs)
File "src/fsm.py", line 337, in get_contacts_and_finish
await profile_mailing(message)
File "src/fsm.py", line 100, in profile_mailing
return_exceptions=True
File "/home/hector/Downloads/Python-3.6.3/Lib/asyncio/tasks.py", line 596, in gather
fut = ensure_future(arg, loop=loop)
File "/home/hector/Downloads/Python-3.6.3/Lib/asyncio/tasks.py", line 526, in ensure_future
raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
async def profile_mailing(message):
state = dp.current_state(chat=message.chat.id,
user=message.from_user.id)
data = await state.get_data()
temp = open('res/texts/template_for_provider.txt').read()
if type(data['location']) == int:
location = 'См. геопозицию'
else:
location = data['location']
if type(data['description']) == int:
description = 'См. файл медиа'
else:
description = data['description']
temp = temp.format(
data['srvc'],
description,
location,
data['contacts']
)
packages = [lambda recipient: bot.send_message(recipient, temp)]
#profile_messages.append((recipient, mess.message_id))
if type(data['description']) == int:
packages.append(lambda recipient: bot.forward_message(
recipient,
message.chat.id,
data['description']
))
if type(data['location']) == int:
packages.append(lambda recipient: bot.forward_message(
recipient,
message.chat.id,
data['location']
))
if data['srvc'] == BL.SRVC_UNDETECTED:
recipients = [FEEDBACK_CHANNEL_CHAT_ID]
else:
recipients = BL.SERVICE_DISTRIBUTION[data['srvc']]
for recipient in recipients:
msgs = asyncio.gather(
map(lambda f: f(recipient), packages),
loop=loop,
return_exceptions=True
)
profile_messages += [(recipient, msg.message_id) for msg in msgs]
profile_messages += data.get('profile_messages', [])
await state.update_data(profile_messages=profile_messages,
last_mailing_time=datetime.now().timestamp())
m
Task exception was never retrieved
future: <Task finished coro=<Dispatcher._process_pooling_updates() done, defined at /home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py:208> exception=TypeError('An asyncio.Future, a coroutine or an awaitable is required',)>
Traceback (most recent call last):
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 215, in _process_pooling_updates
for response in await self.process_updates(updates):
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 103, in process_updates
return await asyncio.gather(*tasks)
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/__init__.py", line 120, in process_update
return await self.message_handlers.notify(update.message)
File "/home/hector/Projects/aiogram_python_env/lib/python3.6/site-packages/aiogram-1.0.dev20171027172954-py3.6.egg/aiogram/dispatcher/handler.py", line 42, in notify
response = await handler(*args, **kwargs)
File "src/fsm.py", line 337, in get_contacts_and_finish
await profile_mailing(message)
File "src/fsm.py", line 100, in profile_mailing
return_exceptions=True
File "/home/hector/Downloads/Python-3.6.3/Lib/asyncio/tasks.py", line 596, in gather
fut = ensure_future(arg, loop=loop)
File "/home/hector/Downloads/Python-3.6.3/Lib/asyncio/tasks.py", line 526, in ensure_future
raise TypeError('An asyncio.Future, a coroutine or an awaitable is '
TypeError: An asyncio.Future, a coroutine or an awaitable is required
async def profile_mailing(message):
state = dp.current_state(chat=message.chat.id,
user=message.from_user.id)
data = await state.get_data()
temp = open('res/texts/template_for_provider.txt').read()
if type(data['location']) == int:
location = 'См. геопозицию'
else:
location = data['location']
if type(data['description']) == int:
description = 'См. файл медиа'
else:
description = data['description']
temp = temp.format(
data['srvc'],
description,
location,
data['contacts']
)
packages = [lambda recipient: bot.send_message(recipient, temp)]
#profile_messages.append((recipient, mess.message_id))
if type(data['description']) == int:
packages.append(lambda recipient: bot.forward_message(
recipient,
message.chat.id,
data['description']
))
if type(data['location']) == int:
packages.append(lambda recipient: bot.forward_message(
recipient,
message.chat.id,
data['location']
))
if data['srvc'] == BL.SRVC_UNDETECTED:
recipients = [FEEDBACK_CHANNEL_CHAT_ID]
else:
recipients = BL.SERVICE_DISTRIBUTION[data['srvc']]
for recipient in recipients:
msgs = asyncio.gather(
map(lambda f: f(recipient), packages),
loop=loop,
return_exceptions=True
)
profile_messages += [(recipient, msg.message_id) for msg in msgs]
profile_messages += data.get('profile_messages', [])
await state.update_data(profile_messages=profile_messages,
last_mailing_time=datetime.now().timestamp())
AR
m
m