add color cmd
This commit is contained in:
1 parent
e0e65ee8fc
commit
39e1e7b395
2 files changed
+15
-3
No files matched your search
+14
-2
@@ -11,7 +11,6 @@ from pnwkit import Order, OrderBy
|
|||||||
|
|
||||||
from botclass import Brahmos, CustomCtx
|
from botclass import Brahmos, CustomCtx
|
||||||
|
|
||||||
|
|
||||||
class Misc(commands.Cog):
|
class Misc(commands.Cog):
|
||||||
def __init__(self, bot: Brahmos):
|
def __init__(self, bot: Brahmos):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
@@ -91,7 +90,20 @@ class Misc(commands.Cog):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return await ctx.cbsend(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}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}]" for n in nations])
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot: commands.Bot):
|
async def setup(bot: commands.Bot):
|
||||||
|
|||||||
+1
-1
@@ -50,7 +50,7 @@ async def get_nation(kit: pnwkit.QueryKit, id: Union[List[int], int]) -> Union[p
|
|||||||
nation = await kit.query(
|
nation = await kit.query(
|
||||||
"nations",
|
"nations",
|
||||||
{"id": id},
|
{"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):
|
if isinstance(id, list):
|
||||||
result = []
|
result = []
|
||||||
|
|||||||
Reference in new issue
Block a user