Only post the outage once
This commit is contained in:
parent
8be03bd275
commit
9c974945ec
@ -28,7 +28,7 @@ class StarCitizen(commands.Cog):
|
|||||||
embed = await star_citizen.get_ship(ship_name=ship)
|
embed = await star_citizen.get_ship(ship_name=ship)
|
||||||
await ctx.send_followup(embed=embed)
|
await ctx.send_followup(embed=embed)
|
||||||
|
|
||||||
@tasks.loop(seconds=60)
|
@tasks.loop(seconds=5)
|
||||||
async def poll_status_page(self):
|
async def poll_status_page(self):
|
||||||
# Wait until the bot is ready before we actually start executing code
|
# Wait until the bot is ready before we actually start executing code
|
||||||
await self.bot.wait_until_ready()
|
await self.bot.wait_until_ready()
|
||||||
@ -40,7 +40,8 @@ class StarCitizen(commands.Cog):
|
|||||||
|
|
||||||
current_status = soup.find("div", {"class": "global-status"}).findNext("span")
|
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
|
# Find the lastest incident
|
||||||
latest_incident = current_status.findNext("h2")
|
latest_incident = current_status.findNext("h2")
|
||||||
details = latest_incident.findNext("div", {"class": "markdown"})
|
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)
|
channel = await self.bot.get_channel(1097567909640929340).send(embed=embed)
|
||||||
|
self.notified = 1
|
||||||
|
else:
|
||||||
|
self.notified = 0
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user