mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-23 19:44:20 +00:00
check for changes in lol data
This commit is contained in:
parent
f5fa2692a0
commit
7046917f6a
1 changed files with 10 additions and 0 deletions
10
database.py
10
database.py
|
@ -62,6 +62,14 @@ class LoL(Base):
|
||||||
|
|
||||||
|
|
||||||
async def update_data(self):
|
async def update_data(self):
|
||||||
|
# Copy the old stats
|
||||||
|
soloq_tier = self.soloq_tier
|
||||||
|
soloq_division = self.soloq_division
|
||||||
|
flexq_tier = self.flexq_tier
|
||||||
|
flexq_division = self.flexq_division
|
||||||
|
ttq_tier = self.ttq_tier
|
||||||
|
ttq_division = self.ttq_division
|
||||||
|
# Get and apply the new data
|
||||||
try:
|
try:
|
||||||
soloq, flexq, ttq = await lol.get_rank_data("euw", self.id)
|
soloq, flexq, ttq = await lol.get_rank_data("euw", self.id)
|
||||||
except lol.LoLAPIError as e:
|
except lol.LoLAPIError as e:
|
||||||
|
@ -95,6 +103,8 @@ class LoL(Base):
|
||||||
self.ttq_division = None
|
self.ttq_division = None
|
||||||
# Mark the user as updated
|
# Mark the user as updated
|
||||||
self.last_updated = datetime.datetime.now()
|
self.last_updated = datetime.datetime.now()
|
||||||
|
# Return if any stat has changed
|
||||||
|
return (soloq_tier != self.soloq_tier) or (soloq_division != self.soloq_division) or (flexq_tier != self.flexq_tier) or (flexq_division != self.flexq_division) or (ttq_tier != self.ttq_tier) or (ttq_division != self.ttq_division)
|
||||||
|
|
||||||
|
|
||||||
def generate_discord_embed(self):
|
def generate_discord_embed(self):
|
||||||
|
|
Loading…
Reference in a new issue