add cmd tp update offshore key

This commit is contained in:
un1xx committed 2025-11-04 23:36:55 +05:30
1 parent ae8d1708c4
commit 75dee03687
3 files changed
+160 -31

No files matched your search

+43 -18
View File
@@ -3,7 +3,7 @@ import asyncio
import datetime
import os
import random
from typing import List, Literal, Optional
from typing import Optional
import discord
from discord.ext import commands, tasks
@@ -14,6 +14,7 @@ from discord.utils import format_dt
from botclass import Brahmos, CustomCtx
class Misc(commands.Cog):
def __init__(self, bot: Brahmos):
self.bot = bot
@@ -80,17 +81,20 @@ class Misc(commands.Cog):
try:
result = await self.kit.query(
"nations",
{"alliance_id": id,
"orderBy": OrderBy("cities", Order.DESC),
"first": 300
{
"alliance_id": id,
"orderBy": OrderBy("cities", Order.DESC),
"first": 300,
},
"id, nation_name, num_cities, alliance {name}"
"id, nation_name, num_cities, alliance {name}",
)
string = f"Nations in alliance {result.nations[0].alliance.name}\n"
i=0
i = 0
for nation in result.nations:
i+=1
string += f"{i:>3}. {nation.id} c{nation.num_cities} {nation.nation_name}\n"
i += 1
string += (
f"{i:>3}. {nation.id} c{nation.num_cities} {nation.nation_name}\n"
)
await ctx.cbsend(string)
except IndexError:
return await ctx.send("> alliance not found.")
@@ -105,11 +109,19 @@ class Misc(commands.Cog):
res = await self.kit.query(
"nations",
{"alliance_id": [10177, 10198]},
"id, leader_name, nation_name, color, vacation_mode_turns"
"id, leader_name, nation_name, color, vacation_mode_turns",
)
nations = [n for n in res.nations if n.color != "olive" and n.vacation_mode_turns == 0]
nations = [
n for n in res.nations if n.color != "olive" and n.vacation_mode_turns == 0
]
await ctx.send(
"> nations not olive:\n" + "\n".join([f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}]" for n in nations])
"> nations not olive:\n"
+ "\n".join(
[
f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}]"
for n in nations
]
)
)
def seconds_until_target(self, hour: int, minute: int = 0):
@@ -124,12 +136,20 @@ class Misc(commands.Cog):
channel = self.bot.get_channel(1356234853217075200)
res = await self.kit.query(
"nations",
{"alliance_id": [10177, 10198], "alliance_position": [2,3,4,5]},
"id, leader_name, nation_name, color, vacation_mode_turns, last_active"
{"alliance_id": [10177, 10198], "alliance_position": [2, 3, 4, 5]},
"id, leader_name, nation_name, color, vacation_mode_turns, last_active",
)
nations = [n for n in res.nations if n.color != "olive" and n.vacation_mode_turns == 0]
nations = [
n for n in res.nations if n.color != "olive" and n.vacation_mode_turns == 0
]
await channel.send(
"> nations not olive:\n" + "\n".join([f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}]" for n in nations])
"> nations not olive:\n"
+ "\n".join(
[
f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}]"
for n in nations
]
)
)
inactives = []
for nation in res.nations:
@@ -141,9 +161,14 @@ class Misc(commands.Cog):
inactives.append(nation)
if inactives:
await channel.send(
"> Inactive nations:\n" + "\n".join([f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}] {format_dt(n.last_active)}" for n in inactives])
)
"> Inactive nations:\n"
+ "\n".join(
[
f"[{n.nation_name}](<https://politicsandwar.com/nation/id={n.id}>) [{n.leader_name}] {format_dt(n.last_active)}"
for n in inactives
]
)
)
@send_daily_message.before_loop
async def before_send_daily_message(self):