update
This commit is contained in:
1 parent
6d67f74669
commit
6e536a09ef
1 file changed
+12
-29
+12
-29
@@ -70,7 +70,14 @@ class WarMonitor(commands.Cog):
|
||||
return f"{num/1000:,.1f}"
|
||||
else:
|
||||
return num
|
||||
def build_embed(nation: pnwkit.Nation, color: discord.Color):
|
||||
def build_embed(nation_id: int, color: discord.Color):
|
||||
nation = await self.kit.query(
|
||||
"nations",
|
||||
{"id": nation_id, "first": 1},
|
||||
"nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes, id"
|
||||
)
|
||||
nation = nation.nations[0]
|
||||
|
||||
em = discord.Embed(
|
||||
title=f"{nation.nation_name} c({nation.num_cities})",
|
||||
color=color,
|
||||
@@ -90,21 +97,9 @@ class WarMonitor(commands.Cog):
|
||||
channel = await self.bot.fetch_channel(WAR_LOG_CHANNEL)
|
||||
|
||||
if war.att_alliance_id: # in MONITORED_ALLIANCES:
|
||||
attacker = await self.kit.query(
|
||||
"nations",
|
||||
{"id": war.att_id, "first": 1},
|
||||
"nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes"
|
||||
)
|
||||
attacker = attacker.nations[0]
|
||||
defender = await self.kit.query(
|
||||
"nations",
|
||||
{"id": war.def_id, "first": 1},
|
||||
"nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes"
|
||||
)
|
||||
defender = defender.nations[0]
|
||||
|
||||
embed1 = build_embed(attacker, discord.Color.green())
|
||||
embed2 = build_embed(defender, discord.Color.green())
|
||||
embed1 = build_embed(war.att_id, discord.Color.green())
|
||||
embed2 = build_embed(war.def_id, discord.Color.green())
|
||||
embed2.timestamp = datetime.datetime.now()
|
||||
|
||||
view = url_button_view(war)
|
||||
@@ -112,21 +107,9 @@ class WarMonitor(commands.Cog):
|
||||
await channel.send(embeds=[embed1, embed2], view=view, content="> WAR (OFFENSIVE)")
|
||||
|
||||
if war.def_alliance_id: #in MONITORED_ALLIANCES:
|
||||
attacker = await self.kit.query(
|
||||
"nations",
|
||||
{"id": war.att_id, "first": 1},
|
||||
"nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes"
|
||||
)
|
||||
attacker = attacker.nations[0]
|
||||
defender = await self.kit.query(
|
||||
"nations",
|
||||
{"id": war.def_id, "first": 1},
|
||||
"nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes"
|
||||
)
|
||||
defender = defender.nations[0]
|
||||
|
||||
embed1 = build_embed(attacker, discord.Color.green())
|
||||
embed2 = build_embed(defender, discord.Color.green())
|
||||
embed1 = build_embed(war.att_id, discord.Color.green())
|
||||
embed2 = build_embed(war.def_id, discord.Color.green())
|
||||
embed2.timestamp = datetime.datetime.now()
|
||||
|
||||
view = url_button_view(war)
|
||||
|
||||
Reference in new issue
Block a user