Only post the outage once

This commit is contained in:
Luke Robles 2023-04-29 17:27:32 -07:00
parent 084f285122
commit 892af7279e

View File

@ -28,7 +28,7 @@ class StarCitizen(commands.Cog):
embed = await star_citizen.get_ship(ship_name=ship)
await ctx.send_followup(embed=embed)
@tasks.loop(seconds=60)
@tasks.loop(seconds=5)
async def poll_status_page(self):
# Wait until the bot is ready before we actually start executing code
await self.bot.wait_until_ready()
@ -40,7 +40,8 @@ class StarCitizen(commands.Cog):
current_status = soup.find("div", {"class": "global-status"}).findNext("span")
if current_status.text != "Operational":
self.notified = 0
if current_status.text != "Operational" and self.notified == 0:
# Find the lastest incident
latest_incident = current_status.findNext("h2")
details = latest_incident.findNext("div", {"class": "markdown"})
@ -62,6 +63,9 @@ class StarCitizen(commands.Cog):
)
channel = await self.bot.get_channel(1097567909640929340).send(embed=embed)
self.notified = 1
else:
self.notified = 0
def setup(bot):