From 29ab3110e57c2823cbf8f7d2b25025810539e1ff Mon Sep 17 00:00:00 2001 From: un1xx Date: Sun, 11 May 2025 17:07:18 +0530 Subject: [PATCH] update owner cmds --- brahmos.py | 17 +++++++++++++++-- exts/banking.py | 11 +++++++---- utils/transactions.py | 17 ----------------- 3 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 utils/transactions.py diff --git a/brahmos.py b/brahmos.py index 21c2802..c486d71 100644 --- a/brahmos.py +++ b/brahmos.py @@ -199,8 +199,21 @@ class Main(commands.Cog): async def shell(self, ctx: commands.Context, *, cmd: codeblock_converter = None): if cmd is None: return - jskgit = bot.get_command("jsk sh") - await ctx.invoke(jskgit, argument=cmd) + jsksh = bot.get_command("jsk sh") + await ctx.invoke(jsksh, argument=cmd) + + + @commands.is_owner() + @commands.command(name="pullr") + async def pullr(self, ctx: CustomCtx): + """ + git pull and restart the bot. + """ + jskgit = bot.get_command("git") + await ctx.invoke(jskgit, argument="pull") + restart = bot.get_command("restart") + await ctx.invoke(restart) + @commands.command() @commands.guild_only() diff --git a/exts/banking.py b/exts/banking.py index 61a9de0..7774beb 100644 --- a/exts/banking.py +++ b/exts/banking.py @@ -180,7 +180,7 @@ class Banking(commands.Cog): @commands.has_any_role("Government", "The Croak Council") @commands.command(aliases=["wc"]) - async def warchest(self, ctx: CustomCtx): + async def warchest(self, ctx: CustomCtx, ids: Optional[commands.Greedy[int]]=None): """ refill warchest of all members """ @@ -201,6 +201,8 @@ class Banking(commands.Cog): ) gator = gator.nations[0] nations.append(gator) + if ids: + nations = [n for n in nations if n.id in ids] for nation in nations: if nation.id not in self.WARCHEST_IDS: @@ -261,9 +263,6 @@ class Banking(commands.Cog): description="\u200b", ) i = 0 - for rd in resource_delta: - i += 1 - e.description += f"{i}. [{rd.get('name')}](https://politicsandwar.com/nation/id={rd.get('id')})\n" total = { "money": 0, "gasoline": 0, @@ -275,6 +274,10 @@ class Banking(commands.Cog): "steel40": 0, } for rd in resource_delta: + i += 1 + e.description += f"{i}. [{rd.get('name')}](https://politicsandwar.com/nation/id={rd.get('id')})\n" + + total["money"] += max(0, rd.get("money")) total["steel100"] += max(0, rd.get("steel100")) total["steel40"] += max(0, rd.get("steel40")) diff --git a/utils/transactions.py b/utils/transactions.py deleted file mode 100644 index 935a2a5..0000000 --- a/utils/transactions.py +++ /dev/null @@ -1,17 +0,0 @@ -import pnwkit - - -class Bank: - def __init__(self, kit: pnwkit.QueryKit): - self.kit = kit - - async def balance(self, id: int): - """ - receiver_type: - () - """ - resources = await self.kit.query( - "alliances", - {"id": 10177, "first": 1}, - "money, food, uranium, coal, iron, oil, bauxite, iron, lead, munitions, gasoline, aluminum, steel", - )