mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Announcements work + task
This commit is contained in:
parent
ade7f8b72e
commit
779a84828b
8 changed files with 145 additions and 13 deletions
|
|
@ -6,6 +6,7 @@ from functions import timeFormatters
|
|||
from functions.config import config
|
||||
from functions.database import currency, poke, prison, birthdays, stats
|
||||
from functions.scraping import getMatchweek
|
||||
from functions import ufora_notifications
|
||||
import json
|
||||
import random
|
||||
import requests
|
||||
|
|
@ -24,6 +25,7 @@ class Tasks(commands.Cog):
|
|||
self.updateMessageCounts.start()
|
||||
self.sendReminders.start()
|
||||
self.updateMatchweek.start()
|
||||
self.uforaAnnouncements.start()
|
||||
|
||||
@tasks.loop(hours=1.0)
|
||||
async def bankInterest(self):
|
||||
|
|
@ -238,6 +240,25 @@ class Tasks(commands.Cog):
|
|||
async def beforeUpdateMatchweek(self):
|
||||
await self.client.wait_until_ready()
|
||||
|
||||
@tasks.loop(minutes=2)
|
||||
async def uforaAnnouncements(self):
|
||||
"""
|
||||
Task that checks for new Ufora announcements every few minutes
|
||||
"""
|
||||
# Get new notifications
|
||||
announcements = ufora_notifications.run()
|
||||
|
||||
if announcements:
|
||||
# TODO change to COC Bot testing if it works
|
||||
announcements_channel = self.client.get_channel(int(constants.ZandbakSpeeltuin))
|
||||
|
||||
for an in announcements:
|
||||
await announcements_channel.send(embed=an.to_embed())
|
||||
|
||||
@uforaAnnouncements.before_loop
|
||||
async def beforeUforaAnnouncements(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