sync wars every 1hr manually

This commit is contained in:
un1xx committed 2025-10-22 20:00:50 +05:30
1 parent c10e96c7b1
commit 7c9222280c
1 file changed
+4 -4
+4 -4
View File
@@ -11,7 +11,6 @@ from typing import List, Literal, Optional, Union
import aiohttp import aiohttp
import discord import discord
from discord.types.channel import Channel
import pnwkit import pnwkit
from discord.ext import commands, tasks from discord.ext import commands, tasks
from discord.utils import format_dt from discord.utils import format_dt
@@ -77,7 +76,7 @@ class WarMonitor(commands.Cog):
self.monitored_wars = [] self.monitored_wars = []
self.allied_nations = [] self.allied_nations = []
@tasks.loop(hours=24) @tasks.loop(hours=12)
async def reload_subscriptions(self): async def reload_subscriptions(self):
self.war_create_task.cancel() self.war_create_task.cancel()
self.war_update_task.cancel() self.war_update_task.cancel()
@@ -90,11 +89,10 @@ class WarMonitor(commands.Cog):
@tasks.loop(hours=1) @tasks.loop(hours=1)
async def war_check(self): async def war_check(self):
channel = await self.bot.fetch_channel(1353940740803133541) channel = await self.bot.fetch_channel(1353940740803133541)
await channel.send("hallo")
message = await channel.send(" syncing wars", delete_after=4) message = await channel.send(" syncing wars", delete_after=4)
ctx = await self.bot.get_context(message) ctx = await self.bot.get_context(message)
command = self.bot.get_command("sync_wars") command = self.bot.get_command("sync_wars")
await ctx.invoke(command, ctx=ctx) await ctx.invoke(command)
@commands.Cog.listener() @commands.Cog.listener()
async def on_ready(self): async def on_ready(self):
@@ -103,6 +101,8 @@ class WarMonitor(commands.Cog):
war_ids = [int(x) for x in war_ids if x.isdigit()] war_ids = [int(x) for x in war_ids if x.isdigit()]
self.monitored_wars.extend(war_ids) self.monitored_wars.extend(war_ids)
await self.set_allied_nations() await self.set_allied_nations()
self.war_check.start()
self.reload_subscriptions.start()
async def set_allied_nations(self): async def set_allied_nations(self):
"""Fetch allied nations.""" """Fetch allied nations."""