fix error

This commit is contained in:
un1xx committed 2025-05-09 19:31:47 +05:30
1 parent e2c37d972e
commit 90740244d3
1 file changed
+8 -7
+8 -7
View File
@@ -12,6 +12,7 @@ import discord
import asyncpg
import pnwkit
from discord.ext import commands
from discord import app_commands
from discord.utils import format_dt
from numerize_denumerize import denumerize, numerize
@@ -74,23 +75,23 @@ class Banking(commands.Cog):
bot_key_api_key=os.getenv("pnwACCKEY"),
aiohttp_session=aiohttp.ClientSession(loop=self.bot.loop),
)
self.FILL = None
self.WARCHEST_IDS = None
async def cog_load(self):
"""Called when the cog is loaded."""
await self.fetch_refill_ids()
await self.fetch_warchest_ids()
async def fetch_refill_ids(self):
"""Fetch nation IDs from the refill table."""
async def fetch_warchest_ids(self):
"""Fetch nation IDs from the warchest table."""
try:
async with self.bot.db_pool.acquire() as conn:
query = "SELECT id FROM refill"
query = "SELECT id FROM warchest"
rows = await conn.fetch(query)
self.FILL = [row[0] for row in rows]
except Exception as e:
self.FILL = []
self.WARCHEST_IDS = []
@commands.has_any_role("Government", "The Croak Council")
@commands.command()
@@ -200,7 +201,7 @@ class Banking(commands.Cog):
nations.append(gator)
for nation in nations:
if nation.id not in self.FILL:
if nation.id not in self.WARCHEST_IDS:
continue
cities = len(nation.cities)
delta = BaseMul.calc(cities, nation)