From 39e1e7b39549cefdc47aed9a38d80ef4c101a127 Mon Sep 17 00:00:00 2001 From: un1xx Date: Sun, 11 May 2025 22:12:47 +0530 Subject: [PATCH] add color cmd --- exts/misc.py | 16 ++++++++++++++-- utils/funcs.py | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/exts/misc.py b/exts/misc.py index 7383eb1..150f5d6 100644 --- a/exts/misc.py +++ b/exts/misc.py @@ -11,7 +11,6 @@ from pnwkit import Order, OrderBy from botclass import Brahmos, CustomCtx - class Misc(commands.Cog): def __init__(self, bot: Brahmos): self.bot = bot @@ -91,7 +90,20 @@ class Misc(commands.Cog): except Exception as e: return await ctx.cbsend(e) - + @commands.command(name="color") + async def color(self, ctx): + """ + return members not olive colored in the alliance + """ + res = await self.kit.query( + "nations", + {"alliance_id": [10177, 10198]}, + "id, leader_name, nation_name, color" + ) + nations = [n for n in res.nations if n.color != "olive"] + await ctx.send( + "> nations not olive:\n" + "\n".join([f"[{n.nation_name}]() [{n.leader_name}]" for n in nations]) + ) async def setup(bot: commands.Bot): diff --git a/utils/funcs.py b/utils/funcs.py index b862c4f..8e2377d 100644 --- a/utils/funcs.py +++ b/utils/funcs.py @@ -50,7 +50,7 @@ async def get_nation(kit: pnwkit.QueryKit, id: Union[List[int], int]) -> Union[p nation = await kit.query( "nations", {"id": id}, - "nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes, id, alliance {name, id, flag}, discord, vacation_mode_turns", + "nation_name, flag, num_cities, soldiers, tanks, aircraft, ships, missiles, score, nukes, id, alliance {name, id, flag}, discord, vacation_mode_turns, color", ) if isinstance(id, list): result = []