update
This commit is contained in:
1 parent
c0505192ee
commit
e511f9282a
1 file changed
+17
-5
+17
-5
@@ -9,6 +9,7 @@ import discord
|
||||
from discord.ext import commands, tasks
|
||||
import pnwkit
|
||||
from pnwkit import Order, OrderBy
|
||||
from discord.utils import format_dt
|
||||
|
||||
from botclass import Brahmos, CustomCtx
|
||||
|
||||
@@ -103,9 +104,9 @@ class Misc(commands.Cog):
|
||||
res = await self.kit.query(
|
||||
"nations",
|
||||
{"alliance_id": [10177, 10198]},
|
||||
"id, leader_name, nation_name, color"
|
||||
"id, leader_name, nation_name, color, vacation_mode_turns"
|
||||
)
|
||||
nations = [n for n in res.nations if n.color != "olive"]
|
||||
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])
|
||||
)
|
||||
@@ -122,13 +123,24 @@ class Misc(commands.Cog):
|
||||
channel = self.bot.get_channel(1356234853217075200)
|
||||
res = await self.kit.query(
|
||||
"nations",
|
||||
{"alliance_id": [10177, 10198]},
|
||||
"id, leader_name, nation_name, color"
|
||||
{"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"]
|
||||
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])
|
||||
)
|
||||
inactives = []
|
||||
for nation in res.nations:
|
||||
if nation.vacation_mode_turns != 0:
|
||||
continue
|
||||
delta = datetime.datetime.utcnow() - nation.last_active
|
||||
if delta > datetime.timedelta(days=2, hours=16):
|
||||
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])
|
||||
)
|
||||
|
||||
|
||||
@send_daily_message.before_loop
|
||||
|
||||
Reference in new issue
Block a user