minor fixes
This commit is contained in:
1 parent
8f14dce2a2
commit
91188e48f1
2 files changed
+171
-6
No files matched your search
+169
-5
@@ -199,7 +199,7 @@ class Banking(commands.Cog):
|
|||||||
embeds = []
|
embeds = []
|
||||||
e = discord.Embed(
|
e = discord.Embed(
|
||||||
title="Warchest Resources",
|
title="Warchest Resources",
|
||||||
timestamp=datetime.datetime.utcnow(),
|
timestamp=datetime.datetime.now(),
|
||||||
color=ctx.author.color,
|
color=ctx.author.color,
|
||||||
)
|
)
|
||||||
count = 0
|
count = 0
|
||||||
@@ -223,7 +223,7 @@ class Banking(commands.Cog):
|
|||||||
embeds.append(e)
|
embeds.append(e)
|
||||||
e = discord.Embed(
|
e = discord.Embed(
|
||||||
title="Warchest Resources",
|
title="Warchest Resources",
|
||||||
timestamp=datetime.datetime.utcnow(),
|
timestamp=datetime.datetime.now(),
|
||||||
color=ctx.author.color,
|
color=ctx.author.color,
|
||||||
)
|
)
|
||||||
count = 0
|
count = 0
|
||||||
@@ -232,7 +232,7 @@ class Banking(commands.Cog):
|
|||||||
embeds.append(e)
|
embeds.append(e)
|
||||||
e = discord.Embed(
|
e = discord.Embed(
|
||||||
title="Nation List",
|
title="Nation List",
|
||||||
timestamp=datetime.datetime.utcnow(),
|
timestamp=datetime.datetime.now(),
|
||||||
color=ctx.author.color,
|
color=ctx.author.color,
|
||||||
description="\u200b",
|
description="\u200b",
|
||||||
)
|
)
|
||||||
@@ -315,6 +315,16 @@ class Banking(commands.Cog):
|
|||||||
if isinstance(rd[k], int) and (rd[k] < 0):
|
if isinstance(rd[k], int) and (rd[k] < 0):
|
||||||
rd[k] = 0
|
rd[k] = 0
|
||||||
try:
|
try:
|
||||||
|
sum = (
|
||||||
|
rd.get("money")
|
||||||
|
+ rd.get("food")
|
||||||
|
+ rd.get("uranium")
|
||||||
|
+ rd.get("gasoline")
|
||||||
|
+ rd.get("munitions")
|
||||||
|
+ rd.get("aluminum")
|
||||||
|
+ rd.get("steel100")
|
||||||
|
)
|
||||||
|
if sum !=0:
|
||||||
await kit.mutation(
|
await kit.mutation(
|
||||||
"bankWithdraw",
|
"bankWithdraw",
|
||||||
{
|
{
|
||||||
@@ -333,6 +343,11 @@ class Banking(commands.Cog):
|
|||||||
)
|
)
|
||||||
pprint.pprint(rd, stream=logstream, indent=3)
|
pprint.pprint(rd, stream=logstream, indent=3)
|
||||||
logmsg += f"{rd.get('name')} <:tick:1275839665819353148>\n"
|
logmsg += f"{rd.get('name')} <:tick:1275839665819353148>\n"
|
||||||
|
else:
|
||||||
|
pprint.pprint(
|
||||||
|
f"{rd.get('name')} (already filled)", stream=logstream, indent=3
|
||||||
|
)
|
||||||
|
logmsg += f"{rd.get('name')} (already filled)\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)
|
||||||
@@ -438,7 +453,7 @@ class Banking(commands.Cog):
|
|||||||
title=f"Resources for {resources.name}",
|
title=f"Resources for {resources.name}",
|
||||||
timestamp=datetime.datetime.utcnow(),
|
timestamp=datetime.datetime.utcnow(),
|
||||||
color=ctx.author.color,
|
color=ctx.author.color,
|
||||||
url= f"https://politicsandwar.com/alliance/id={resources.id}"
|
url=f"https://politicsandwar.com/alliance/id={resources.id}",
|
||||||
)
|
)
|
||||||
e.description = (
|
e.description = (
|
||||||
f"{Emojis.money} {resources.money:,}\n"
|
f"{Emojis.money} {resources.money:,}\n"
|
||||||
@@ -455,11 +470,160 @@ class Banking(commands.Cog):
|
|||||||
f"{Emojis.steel} {resources.steel:,}"
|
f"{Emojis.steel} {resources.steel:,}"
|
||||||
)
|
)
|
||||||
e.set_thumbnail(url=resources.flag)
|
e.set_thumbnail(url=resources.flag)
|
||||||
e.set_footer(text='Bank', icon_url=ctx.author.avatar)
|
e.set_footer(text="Bank", icon_url=ctx.author.avatar)
|
||||||
embeds.append(e)
|
embeds.append(e)
|
||||||
|
|
||||||
await ctx.paginate(pages=embeds)
|
await ctx.paginate(pages=embeds)
|
||||||
|
|
||||||
|
@commands.has_role(987770837627187250)
|
||||||
|
@commands.command()
|
||||||
|
async def transfer(self, ctx: CustomCtx):
|
||||||
|
"""transfer resources"""
|
||||||
|
if ctx.author.id not in [
|
||||||
|
367740727624466433,
|
||||||
|
322156710590676993,
|
||||||
|
407135783678640128,
|
||||||
|
444896160105103361,
|
||||||
|
]:
|
||||||
|
return await ctx.send("-# You are not in list of authorized users")
|
||||||
|
alliances = {10177: "Man I Love Frogs", 10198: "Damn I Love Frogs"}
|
||||||
|
e = discord.Embed(
|
||||||
|
timestamp=datetime.datetime.now(),
|
||||||
|
title="Transfer Resources",
|
||||||
|
color=ctx.author.color,
|
||||||
|
)
|
||||||
|
e.add_field(name="Transferring From", value=alliances.get(10177))
|
||||||
|
|
||||||
|
sel_alliance = 10177
|
||||||
|
|
||||||
|
class TransferView(BasicView):
|
||||||
|
def __init__(self, timeout: float | None = 60, clear: bool | None = False):
|
||||||
|
super().__init__(timeout=timeout, clear=clear)
|
||||||
|
|
||||||
|
@discord.ui.button(
|
||||||
|
label="change alliance", style=discord.ButtonStyle.blurple
|
||||||
|
)
|
||||||
|
async def change_alliance(self, i: discord.Interaction, _):
|
||||||
|
nonlocal sel_alliance
|
||||||
|
sel_alliance = 10198 if sel_alliance == 10177 else 10177
|
||||||
|
e.set_field_at(
|
||||||
|
0, name="Transferring From", value=alliances.get(sel_alliance)
|
||||||
|
)
|
||||||
|
e.remove_field(1)
|
||||||
|
await i.message.edit(embed=e)
|
||||||
|
|
||||||
|
@discord.ui.button(
|
||||||
|
label="transfer to nation", style=discord.ButtonStyle.blurple
|
||||||
|
)
|
||||||
|
async def transfer_to_nation(self, i: discord.Interaction, _):
|
||||||
|
class NationModal(discord.ui.Modal, title="Nation Details"):
|
||||||
|
nation = discord.ui.TextInput(
|
||||||
|
label="Nation ID/name",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
placeholder="nation id or name",
|
||||||
|
max_length=32,
|
||||||
|
required=True,
|
||||||
|
)
|
||||||
|
money = discord.ui.TextInput(
|
||||||
|
label="Money",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="money",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
food = discord.ui.TextInput(
|
||||||
|
label="Food",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="food",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
uranium = discord.ui.TextInput(
|
||||||
|
label="Uranium",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="uranium",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
coal = discord.ui.TextInput(
|
||||||
|
label="Coal",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="coal",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
iron = discord.ui.TextInput(
|
||||||
|
label="Iron",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="iron",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
oil = discord.ui.TextInput(
|
||||||
|
label="Oil",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="oil",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
bauxite = discord.ui.TextInput(
|
||||||
|
label="Bauxite",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="bauxite",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
lead = discord.ui.TextInput(
|
||||||
|
label="Lead",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="lead",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
munitions = discord.ui.TextInput(
|
||||||
|
label="Munitions",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="munitions",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
gasoline = discord.ui.TextInput(
|
||||||
|
label="Gasoline",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="gasoline",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
aluminum = discord.ui.TextInput(
|
||||||
|
label="Aluminum",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="aluminum",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
steel = discord.ui.TextInput(
|
||||||
|
label="Steel",
|
||||||
|
style=discord.TextStyle.short,
|
||||||
|
max_length=15,
|
||||||
|
placeholder="steel",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
def __init__(self, view: TransferView):
|
||||||
|
super().__init__(timeout=60)
|
||||||
|
self.view = view
|
||||||
|
|
||||||
|
async def on_submit(self, interaction: discord.Interaction):
|
||||||
|
e = i.message.embeds[0]
|
||||||
|
e.description = ...
|
||||||
|
|
||||||
|
@discord.ui.button(label="cancel", style=discord.ButtonStyle.red)
|
||||||
|
async def cancel(self, i: discord.Interaction, _):
|
||||||
|
await i.message.edit(
|
||||||
|
content="> transaction cancelled", embed=None, view=None
|
||||||
|
)
|
||||||
|
self.stop()
|
||||||
|
|
||||||
|
|
||||||
async def setup(bot: Brahmos):
|
async def setup(bot: Brahmos):
|
||||||
await bot.add_cog(Banking(bot))
|
await bot.add_cog(Banking(bot))
|
||||||
+2
-1
@@ -16,5 +16,6 @@
|
|||||||
565984,
|
565984,
|
||||||
604712,
|
604712,
|
||||||
574264,
|
574264,
|
||||||
103764
|
103764,
|
||||||
|
608467
|
||||||
]
|
]
|
||||||
Reference in new issue
Block a user