mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Scrape current jpl matchweek every few hours
This commit is contained in:
parent
d9d8c6a842
commit
2b96f3ec41
3 changed files with 46 additions and 4 deletions
|
|
@ -3,7 +3,9 @@ from data.remind import Reminders
|
|||
from discord.ext import commands, tasks
|
||||
from enums.numbers import Numbers
|
||||
from functions import timeFormatters
|
||||
from functions.config import config
|
||||
from functions.database import currency, poke, prison, birthdays, stats
|
||||
from functions.scraping import getMatchweek
|
||||
import json
|
||||
import random
|
||||
import requests
|
||||
|
|
@ -21,6 +23,7 @@ class Tasks(commands.Cog):
|
|||
self.checkBirthdays.start()
|
||||
self.updateMessageCounts.start()
|
||||
self.sendReminders.start()
|
||||
self.updateMatchweek.start()
|
||||
|
||||
@tasks.loop(hours=1.0)
|
||||
async def bankInterest(self):
|
||||
|
|
@ -218,9 +221,22 @@ class Tasks(commands.Cog):
|
|||
async def beforeSendReminders(self):
|
||||
await self.client.wait_until_ready()
|
||||
|
||||
# TODO
|
||||
@tasks.loop(hours=2.0)
|
||||
async def updateMatchweek(self):
|
||||
pass
|
||||
"""
|
||||
Task that checks the current JPL matchweek & changes the dict value
|
||||
"""
|
||||
matchweek = getMatchweek()
|
||||
|
||||
if matchweek is None:
|
||||
return
|
||||
|
||||
# Change the setting in the config
|
||||
config("jpl_day", int(matchweek))
|
||||
|
||||
@updateMatchweek.before_loop
|
||||
async def beforeUpdateMatchweek(self):
|
||||
await self.client.wait_until_ready()
|
||||
|
||||
def getCurrentHour(self):
|
||||
return timeFormatters.dateTimeNow().hour
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue