update warchest cmd

This commit is contained in:
un1xx committed 2024-08-21 20:53:25 +05:30
1 parent 13dc675173
commit d1efa6f648
1 file changed
+7 -7
+7 -7
View File
@@ -201,7 +201,7 @@ class Banking(commands.Cog):
class ConfirmButton(discord.ui.Button): class ConfirmButton(discord.ui.Button):
def __init__(self, *, style = discord.ButtonStyle.green, label= "confirm", bot: Brahmos, p: Paginator): def __init__(self, *, style = discord.ButtonStyle.green, label= "confirm", bot: Brahmos, p: Paginator):
super.__init__(style=style, label=label) super().__init__(style=style, label=label)
self.bot = bot self.bot = bot
self.v = p self.v = p
@@ -209,7 +209,7 @@ class Banking(commands.Cog):
async def interaction_check(self, interaction: discord.Interaction) -> bool: async def interaction_check(self, interaction: discord.Interaction) -> bool:
return interaction.user == ctx.author return interaction.user == ctx.author
async def callback(self, interaction: discord.Interaction) -> io.Any: async def callback(self, interaction: discord.Interaction):
kit = pnwkit.QueryKit( kit = pnwkit.QueryKit(
api_key=os.getenv("pnwDILFKEY"), api_key=os.getenv("pnwDILFKEY"),
@@ -225,8 +225,8 @@ class Banking(commands.Cog):
self.style= discord.ButtonStyle.blurple self.style= discord.ButtonStyle.blurple
self.v.clear_items() self.v.clear_items()
self.v.add_item(self) self.v.add_item(self)
e = discord.Embed(color=discord.Color.blurple, timestamp=datetime.datetime.utcnow(), title="Transferring resources") e = discord.Embed(color=discord.Color.blurple(), timestamp=datetime.datetime.utcnow(), title="Transferring resources")
await interaction.message.edit(embed=e, view=v) await interaction.message.edit(embed=e, view=self.v)
for rd in resource_delta: for rd in resource_delta:
for k in rd: # remove negatives for k in rd: # remove negatives
if (isinstance(rd[k]), int) and (rd[k] < 0): if (isinstance(rd[k]), int) and (rd[k] < 0):
@@ -249,20 +249,20 @@ class Banking(commands.Cog):
"id" "id"
) )
pprint.pprint(rd, stream=logstream, indent=3) pprint.pprint(rd, stream=logstream, indent=3)
logmsg += f"{rd.get("name")} <:tick:1275824967522717707>\n" logmsg += f"{rd.get('name')} <:tick:1275824967522717707>\n"
e.description = logmsg e.description = logmsg
await interaction.message.edit(embed=e) await interaction.message.edit(embed=e)
await asyncio.sleep(1) await asyncio.sleep(1)
except Exception as e: except Exception as e:
pprint.pprint(f"{rd.get('name')} -> {e}", stream=logstream, indent=3) pprint.pprint(f"{rd.get('name')} -> {e}", stream=logstream, indent=3)
logmsg += f"{rd.get("name")} <:cross:1275824989131505779>\n" logmsg += f"{rd.get('name')} <:cross:1275824989131505779>\n"
e.description = logmsg e.description = logmsg
await interaction.message.edit(embed=e) await interaction.message.edit(embed=e)
await asyncio.sleep(1) await asyncio.sleep(1)
await interaction.message.edit(view=None) await interaction.message.edit(view=None)
await ctx.send(file=discord.File(logstream, filename="log.txt")) await ctx.send(file=discord.File(logstream, filename="log.txt"))
paginator = ctx.Paginator(pages=embeds) paginator = ctx.Paginator(pages=embeds)
paginator.start(ctx=ctx, custom_items=[ConfirmButton(bot=self.bot, p=paginator)]) await paginator.start(ctx=ctx, custom_items=[ConfirmButton(bot=self.bot, p=paginator)])