Skip to content

Commit

Permalink
cache stupid
Browse files Browse the repository at this point in the history
  • Loading branch information
mralext20 committed Jun 8, 2024
1 parent c3e6a52 commit 623fb52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions alexBot/cogs/smartHome.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,9 @@ async def on_presence_update(self, before: discord.Member, after: discord.Member
if before.status != after.status:
mqtt: HomeAssistantIntigreation = self.bot.get_cog("HomeAssistantIntigreation") # type: ignore
blob = {"status": after.status.value, "mobile": after.is_on_mobile()}
self.status_cache[after.id] = blob
if self.status_cache[before.id] != blob:

if self.status_cache.get(after.id) != blob:
self.status_cache[after.id] = blob
await mqtt.mqttPublish(f"discord/{after.id}/status", json.dumps(blob))


Expand Down

0 comments on commit 623fb52

Please sign in to comment.