Skip to content

Commit

Permalink
fix: clan data being empty
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Jul 28, 2024
1 parent a0d17eb commit 6c96506
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions bot/clan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,15 @@ async def raid_weekend_track(clan_tags: List[str], db_client: MongoDatabase, coc

clan_data = CLAN_CACHE.get(clan_tag)

json_data = {"type": "raid_attacks",
"clan_tag": current_raid.clan_tag,
"attacked" : attacked,
"raid": current_raid._raw_data,
"old_raid" : previous_raid._raw_data,
"clan" : clan_data._raw_data
}
producer.send("capital", ujson.dumps(json_data).encode("utf-8"), key=clan_tag.encode("utf-8"), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp() * 1000))
if clan_data:
json_data = {"type": "raid_attacks",
"clan_tag": current_raid.clan_tag,
"attacked" : attacked,
"raid": current_raid._raw_data,
"old_raid" : previous_raid._raw_data,
"clan" : clan_data._raw_data
}
producer.send("capital", ujson.dumps(json_data).encode("utf-8"), key=clan_tag.encode("utf-8"), timestamp_ms=int(pend.now(tz=pend.UTC).timestamp() * 1000))

if current_raid.state != previous_raid.state:
json_data = {"type": "raid_state", "clan_tag": current_raid.clan_tag, "old_raid": previous_raid._raw_data, "raid": current_raid._raw_data}
Expand Down

0 comments on commit 6c96506

Please sign in to comment.