reformat
This commit is contained in:
1 parent
783b38e28d
commit
32ee918415
10 files changed
+88
-71
No files matched your search
@@ -15,6 +15,7 @@ import aiofiles
|
||||
import aiohttp
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
|
||||
from utils.paginator import Paginator
|
||||
|
||||
ownerid = json.load(open("store/cfg.json"))["ReplOwners"]
|
||||
|
||||
+54
-50
@@ -1,16 +1,18 @@
|
||||
import aiohttp
|
||||
import datetime
|
||||
import os
|
||||
import random
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
import aiohttp
|
||||
import discord
|
||||
from botclass import CustomCtx, Brahmos
|
||||
from discord.ext import commands
|
||||
import pnwkit
|
||||
from discord.ext import commands
|
||||
|
||||
from botclass import Brahmos, CustomCtx
|
||||
from utils.base import BasicView
|
||||
from utils.emojis import Emojis
|
||||
|
||||
|
||||
class Banking(commands.Cog):
|
||||
def __init__(self, bot: Brahmos):
|
||||
self.bot = bot
|
||||
@@ -18,9 +20,9 @@ class Banking(commands.Cog):
|
||||
api_key=os.getenv("pnwAPIKEY"),
|
||||
bot_key=os.getenv("pnwBOTKEY"),
|
||||
bot_key_api_key=os.getenv("pnwACCKEY"),
|
||||
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop)
|
||||
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop),
|
||||
)
|
||||
|
||||
|
||||
@commands.has_role(987770837627187250)
|
||||
@commands.command()
|
||||
async def tmilf(self, ctx: CustomCtx):
|
||||
@@ -31,73 +33,75 @@ class Banking(commands.Cog):
|
||||
resources = await self.kit.query(
|
||||
"alliances",
|
||||
{"id": 10177, "first": 1},
|
||||
"money, food, uranium, coal, iron, oil, bauxite, iron, lead, munitions, gasoline, aluminum, steel"
|
||||
"money, food, uranium, coal, iron, oil, bauxite, iron, lead, munitions, gasoline, aluminum, steel",
|
||||
)
|
||||
resources = resources.alliances[0]
|
||||
e = discord.Embed(
|
||||
color=discord.Color.yellow(),
|
||||
timestamp=datetime.datetime.utcnow(),
|
||||
title="Approve Transaction"
|
||||
title="Approve Transaction",
|
||||
)
|
||||
e.description = (
|
||||
"Transferring resources to **Damn I Love Frogs**\n"
|
||||
f"{Emojis.money} {resources.money:,}\n"
|
||||
f"{Emojis.food} {resources.food:,}\n"
|
||||
f"{Emojis.uranium} {resources.uranium:,}\n"
|
||||
f"{Emojis.coal} {resources.coal:,}\n"
|
||||
f"{Emojis.iron} {resources.iron:,}\n"
|
||||
f"{Emojis.oil} {resources.oil:,}\n"
|
||||
f"{Emojis.bauxite} {resources.bauxite:,}\n"
|
||||
f"{Emojis.lead} {resources.lead:,}\n"
|
||||
f"{Emojis.munitions} {resources.munitions:,}\n"
|
||||
f"{Emojis.gasoline} {resources.gasoline:,}\n"
|
||||
f"{Emojis.aluminum} {resources.aluminum:,}\n"
|
||||
f"{Emojis.steel} {resources.steel:,}"
|
||||
)
|
||||
e.description = ("Transferring resources to **Damn I Love Frogs**\n"
|
||||
f"{Emojis.money} {resources.money:,}\n"
|
||||
f"{Emojis.food} {resources.food:,}\n"
|
||||
f"{Emojis.uranium} {resources.uranium:,}\n"
|
||||
f"{Emojis.coal} {resources.coal:,}\n"
|
||||
f"{Emojis.iron} {resources.iron:,}\n"
|
||||
f"{Emojis.oil} {resources.oil:,}\n"
|
||||
f"{Emojis.bauxite} {resources.bauxite:,}\n"
|
||||
f"{Emojis.lead} {resources.lead:,}\n"
|
||||
f"{Emojis.munitions} {resources.munitions:,}\n"
|
||||
f"{Emojis.gasoline} {resources.gasoline:,}\n"
|
||||
f"{Emojis.aluminum} {resources.aluminum:,}\n"
|
||||
f"{Emojis.steel} {resources.steel:,}"
|
||||
)
|
||||
|
||||
|
||||
class View(BasicView):
|
||||
def __init__(self, timeout: float | None = 60, clear: bool | None = False, kit: pnwkit.QueryKit = None):
|
||||
def __init__(
|
||||
self,
|
||||
timeout: float | None = 60,
|
||||
clear: bool | None = False,
|
||||
kit: pnwkit.QueryKit = None,
|
||||
):
|
||||
super().__init__(timeout, clear)
|
||||
self.kit = kit
|
||||
|
||||
|
||||
@discord.ui.button(
|
||||
label="cancel",
|
||||
style=discord.ButtonStyle.red
|
||||
)
|
||||
|
||||
@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)
|
||||
await i.message.edit(
|
||||
content="> transaction cancelled", embed=None, view=None
|
||||
)
|
||||
self.stop()
|
||||
|
||||
@discord.ui.button(
|
||||
label="confirm",
|
||||
style=discord.ButtonStyle.green
|
||||
)
|
||||
|
||||
@discord.ui.button(label="confirm", style=discord.ButtonStyle.green)
|
||||
async def confirm(self, i: discord.Interaction, _):
|
||||
e.title = "Transaction Approved"
|
||||
e.description = e.description.replace("Transferring", "Transferred")
|
||||
e.color = discord.Color.green()
|
||||
await self.kit.mutation(
|
||||
"bankWithdraw",
|
||||
{"receiver": 10198,
|
||||
"receiver_type": 2,
|
||||
"money" : resources.money,
|
||||
"food" : resources.food,
|
||||
"uranium" : resources.uranium,
|
||||
"coal" : resources.coal,
|
||||
"iron": resources.iron,
|
||||
"oil" : resources.oil,
|
||||
"bauxite" : resources.bauxite,
|
||||
"lead" : resources.lead,
|
||||
"munitions" : resources.munitions,
|
||||
"gasoline" : resources.gasoline,
|
||||
"aluminum" : resources.aluminum,
|
||||
"steel" : resources.steel
|
||||
{
|
||||
"receiver": 10198,
|
||||
"receiver_type": 2,
|
||||
"money": resources.money,
|
||||
"food": resources.food,
|
||||
"uranium": resources.uranium,
|
||||
"coal": resources.coal,
|
||||
"iron": resources.iron,
|
||||
"oil": resources.oil,
|
||||
"bauxite": resources.bauxite,
|
||||
"lead": resources.lead,
|
||||
"munitions": resources.munitions,
|
||||
"gasoline": resources.gasoline,
|
||||
"aluminum": resources.aluminum,
|
||||
"steel": resources.steel,
|
||||
},
|
||||
"id"
|
||||
"id",
|
||||
)
|
||||
await i.message.edit(embed=e, view=None)
|
||||
self.stop()
|
||||
|
||||
await ctx.send(embed=e, view=View(kit=self.kit))
|
||||
|
||||
|
||||
|
||||
+4
-3
@@ -3,9 +3,10 @@ import random
|
||||
from typing import List, Literal, Optional
|
||||
|
||||
import discord
|
||||
from botclass import CustomCtx, Brahmos
|
||||
from discord.ext import commands
|
||||
|
||||
from botclass import Brahmos, CustomCtx
|
||||
|
||||
|
||||
class Misc(commands.Cog):
|
||||
def __init__(self, bot: Brahmos):
|
||||
@@ -28,13 +29,13 @@ class Misc(commands.Cog):
|
||||
"yes",
|
||||
"not with u lmao",
|
||||
"in your dreams",
|
||||
"no"
|
||||
"no",
|
||||
]
|
||||
|
||||
num = random.randint(1, 10)
|
||||
reply = random.choice(replies_common)
|
||||
if num <= 2:
|
||||
reply = replies_rare[random.randint(0,1)]
|
||||
reply = replies_rare[random.randint(0, 1)]
|
||||
await ctx.send(reply)
|
||||
|
||||
@commands.command(name="snowflake")
|
||||
|
||||
Reference in new issue
Block a user