Pincer
Pincer copied to clipboard
♻️ Improving tasks for architectural liberty
Tasks are kinda bound to either to bot or cogs cause of the tasks.loop decorator.
Currently, to have all the tasks within a tasks directory, you need a cog and something like this within its __init__:
from https://github.com/Pincer-org/Pincer-Bot/blob/main/pincer_bot/cogs/info.py
from pincer_bot.tasks.get_pypi_downloads import get_pypi_stats
# ...
def __init__(self, client):
self.client = client
task = TaskScheduler(self.client)
self.get_pypi_downloads = task.loop(minutes=10)(get_pypi_stats)
self.get_pypi_downloads.start()
A rewrite allowing to have tasks seperated more easily would be great