minor fixes

This commit is contained in:
un1xx committed 2025-11-08 14:15:35 +05:30
1 parent 9bf35bef61
commit 0ed0c713de
2 files changed
+16 -12

No files matched your search

+10 -8
View File
@@ -4,7 +4,6 @@ import functools
import logging
import os
import aiohttp
import discord
import pnwkit
@@ -12,7 +11,7 @@ from discord.ext import commands, tasks
from botclass import Brahmos, CustomCtx
from utils.emojis import Emojis
from utils.funcs import format_count, timeline_button, get_nation, get_war
from utils.funcs import format_count, get_nation, get_war, timeline_button
ALLIANCE_ID = 10177
GUILD = 1353930666311421952
@@ -201,8 +200,8 @@ class WarMonitor(commands.Cog):
# create war channel for defensive wars
await self.defense_handler(war)
async def get_war_channel(self, id: int) -> discord.TextChannel:
id = str(id)
async def get_war_channel(self, ch_id) -> discord.TextChannel | None:
ch_id = str(ch_id)
categories = [await self.bot.fetch_channel(cat) for cat in CATEGORIES]
channels = [ch for cat in categories for ch in cat.text_channels]
channel = [c for c in channels if id in c.name]
@@ -512,10 +511,11 @@ class WarMonitor(commands.Cog):
async def archive(self, ctx: CustomCtx):
categories = [await self.bot.fetch_channel(cat) for cat in CATEGORIES]
channels = [ch for cat in categories for ch in cat.text_channels]
if ctx.channel not in channels:
await ctx.send(f"this command only works inside {category.name}")
return
archive = await self.bot.fetch_channel(ARCHIVE_CATEGORY)
if ctx.channel not in channels:
await ctx.send(f"this command only works inside {archive.name}")
return
if len(archive.text_channels) == 50:
await ctx.send(
"> hit channel limit in archive, please delete some channels first"
@@ -549,7 +549,7 @@ class WarMonitor(commands.Cog):
await ctx.channel.delete()
@commands.command()
@commands.has_permissions(administrator=True)
@commands.has_any_role("The Croak Council", "Government", "Military Affairs [MA]")
async def delall(self, ctx: CustomCtx):
category = await self.bot.fetch_channel(ARCHIVE_CATEGORY)
if ctx.channel not in category.text_channels:
@@ -561,10 +561,12 @@ class WarMonitor(commands.Cog):
except Exception as e:
await ctx.send(f"failed to delete channel: {e}")
@commands.has_any_role("The Croak Council", "Government", "Military Affairs [MA]")
@commands.command()
async def monitored(self, ctx: CustomCtx):
await ctx.send(self.monitored_wars)
@commands.has_any_role("The Croak Council", "Government", "Military Affairs [MA]")
@commands.command()
async def monitor(self, ctx: CustomCtx, id: int):
self.monitored_wars.append(id)