fix(updatechecker): use discord.ext tasks
Some checks failed
Build Documentation and Lint Code / build and lint (pull_request) Failing after 24s
Some checks failed
Build Documentation and Lint Code / build and lint (pull_request) Failing after 24s
This commit is contained in:
parent
0695dc061e
commit
8664c883a5
1 changed files with 2 additions and 4 deletions
|
@ -36,6 +36,7 @@ from urllib.parse import urlparse
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import discord
|
import discord
|
||||||
|
from discord.ext import tasks
|
||||||
from redbot.cogs.downloader.repo_manager import Repo
|
from redbot.cogs.downloader.repo_manager import Repo
|
||||||
from redbot.core import Config, commands
|
from redbot.core import Config, commands
|
||||||
from redbot.core.utils.chat_formatting import box, humanize_list, inline
|
from redbot.core.utils.chat_formatting import box, humanize_list, inline
|
||||||
|
@ -72,10 +73,8 @@ class UpdateChecker(commands.Cog):
|
||||||
"""This cog does not store user data"""
|
"""This cog does not store user data"""
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@tasks.loop(minutes=1)
|
||||||
async def bg_task(self):
|
async def bg_task(self):
|
||||||
await self.bot.wait_until_ready()
|
|
||||||
# Just in case
|
|
||||||
await asyncio.sleep(10)
|
|
||||||
while True:
|
while True:
|
||||||
cog = self.bot.get_cog("Downloader")
|
cog = self.bot.get_cog("Downloader")
|
||||||
if cog is not None:
|
if cog is not None:
|
||||||
|
@ -246,7 +245,6 @@ class UpdateChecker(commands.Cog):
|
||||||
pass
|
pass
|
||||||
await asyncio.sleep(1)
|
await asyncio.sleep(1)
|
||||||
await self.conf.repos.set(saving_dict)
|
await self.conf.repos.set(saving_dict)
|
||||||
await asyncio.sleep(60)
|
|
||||||
|
|
||||||
async def fetch_feed(self, url: str):
|
async def fetch_feed(self, url: str):
|
||||||
# Thank's to Sinbad's rss cog after which I copied this
|
# Thank's to Sinbad's rss cog after which I copied this
|
||||||
|
|
Loading…
Reference in a new issue