update rss cmd to use nation names

This commit is contained in:
un1xx committed 2024-09-03 22:25:41 +05:30
1 parent 660dd7bea0
commit 8c9f197544
2 files changed
+13 -3

No files matched your search

+12 -3
View File
@@ -353,7 +353,7 @@ class Banking(commands.Cog):
)
@commands.has_role(987770837627187250)
@commands.command()
async def rss(self, ctx: CustomCtx, ids: commands.Greedy[int] = []):
async def rss(self, ctx: CustomCtx, ids: commands.Greedy[int] = [], nation_names: commands.Greedy[str] = []):
"""get resources of a nation in alliance
Args:
@@ -368,12 +368,20 @@ class Banking(commands.Cog):
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop),
)
embeds = []
for n in nation_names:
result = await self.kit.query(
"nations",
{"nation_name": n, "first": 1},
"id"
)
ids.append(result.nations[0].id)
for id in ids:
kit = self.kit if (id != 103764) else d_kit
nation = await kit.query(
"nations",
{"id": id, "first": 1},
"id, nation_name, discord,money, flag, food, uranium, coal, iron, oil, bauxite, iron, lead, munitions, gasoline, aluminum, steel, num_cities",
"id, nation_name, discord,money, flag, food, uranium, coal, iron, oil, bauxite, iron, lead, munitions, gasoline, aluminum, steel, num_cities, credits",
)
nation = nation.nations[0]
e = discord.Embed(
@@ -395,7 +403,8 @@ class Banking(commands.Cog):
f"{Emojis.munitions} {nation.munitions:,}\n"
f"{Emojis.gasoline} {nation.gasoline:,}\n"
f"{Emojis.aluminum} {nation.aluminum:,}\n"
f"{Emojis.steel} {nation.steel:,}"
f"{Emojis.steel} {nation.steel:,}\n"
f"{Emojis.credits} {nation.credits}\n"
)
embeds.append(e)
+1
View File
@@ -14,3 +14,4 @@ class Emojis:
oil = "<:oil:1220371873267843143>"
coal = "<:coal:1220371877013229619>"
money = "<:dollarsym:1220378339970252841>"
credits = "<:credits:1280569595366867066>"