КП
Size: a a a
КП
F
# Отправление по таймингуОшибка
async def scheduled(sleep_for, queue):
while True:
await asyncio.sleep(sleep_for)
# получаем список подписчиков бота
subscriptions = db.get_subscriptions()
# Отправляем всем подписчикам
for s in subscriptions:
for obj in zip(tokens, clientLogins):
await bot.send_message(s[1], yaBalance(obj[0], obj[1]), disable_notification=True)
# запускаем лонг поллинг
if __name__ == '__main__':
dp.loop.create_task(scheduled(10))
executor.start_polling(dp, skip_updates=True)
Traceback (most recent call last):
File "E:/Python/ads_tgbot/bot.py", line 88, in <module>
dp.loop.create_task(scheduled(10))
AttributeError: 'NoneType' object has no attribute 'create_task'
F
F
КП
КП
СЗ
КП
F
СЗ
F
F
F
СЗ
import config
from config import tokens, clientLogins
from ya import yaBalance
import logging
import asyncio
from datetime import datetime
from dbrun import BotSub
from aiogram import Bot, Dispatcher, executor, types
from aiogram.types import ReplyKeyboardMarkup, KeyboardButton
# Задаем уровень логов
logging.basicConfig(level=logging.INFO)
# Инициализация бота
bot = Bot(token=config.tokenbot)
dp = Dispatcher(bot)
# инициализируем соединение с БД
db = BotSub('db.db')
# Отправление по таймингу
async def scheduled(sleep_for, queue):
while True:
await asyncio.sleep(sleep_for)
# получаем список подписчиков бота
subscriptions = db.get_subscriptions()
# Отправляем всем подписчикам
for s in subscriptions:
for obj in zip(tokens, clientLogins):
await bot.send_message(s[1], yaBalance(obj[0], obj[1]), disable_notification=True)
# запускаем лонг поллинг
if __name__ == '__main__':
dp.loop.create_task(scheduled(10))
executor.start_polling(dp, skip_updates=True)
F
СЗ
ИК
# Отправление по таймингуОшибка
async def scheduled(sleep_for, queue):
while True:
await asyncio.sleep(sleep_for)
# получаем список подписчиков бота
subscriptions = db.get_subscriptions()
# Отправляем всем подписчикам
for s in subscriptions:
for obj in zip(tokens, clientLogins):
await bot.send_message(s[1], yaBalance(obj[0], obj[1]), disable_notification=True)
# запускаем лонг поллинг
if __name__ == '__main__':
dp.loop.create_task(scheduled(10))
executor.start_polling(dp, skip_updates=True)
Traceback (most recent call last):
File "E:/Python/ads_tgbot/bot.py", line 88, in <module>
dp.loop.create_task(scheduled(10))
AttributeError: 'NoneType' object has no attribute 'create_task'
ИК
СЗ
C