Fix time for job
First pass at boss spawn monitoring fix channel id
This commit is contained in:
parent
dae89e9f60
commit
3ec7b22e5b
@ -10,9 +10,11 @@ import requests
|
||||
import tarkov
|
||||
|
||||
if os.getenv("DRAGON_ENV") == "prod":
|
||||
channel_id = 1097567909640929340
|
||||
channel_id = 815310511776202773
|
||||
time_limit = 600
|
||||
else:
|
||||
channel_id = 932476007439552522
|
||||
time_limit = 10
|
||||
|
||||
|
||||
class Tarkov(commands.Cog):
|
||||
@ -22,25 +24,25 @@ class Tarkov(commands.Cog):
|
||||
|
||||
tarkov = discord.SlashCommandGroup("tarkov", "Tarkov related commands")
|
||||
|
||||
@tasks.loop(seconds=10)
|
||||
@tasks.loop(seconds=time_limit)
|
||||
async def check_boss_spawns(self):
|
||||
# Wait until the bot is ready before we actually start executing code
|
||||
await self.bot.wait_until_ready()
|
||||
|
||||
levels = tarkov.tarkov_boss_info()
|
||||
most_recent_spawns = tarkov.tarkov_boss_info()
|
||||
|
||||
if os.path.exists("/tmp/boss_spawns.txt"):
|
||||
|
||||
current_spawns = eval(open("/tmp/boss_spawns.txt", "r").read())
|
||||
known_spawns = eval(open("/tmp/boss_spawns.txt", "r").read())
|
||||
|
||||
if levels != current_spawns:
|
||||
if most_recent_spawns != known_spawns:
|
||||
print("Boss spawns have changed")
|
||||
|
||||
embed = discord.Embed(
|
||||
description="-------", color=discord.Color.blue(), type="rich"
|
||||
)
|
||||
embed.set_author(name="🎲 Boss Spawns have updated 🎲")
|
||||
for key, value in current_spawns.items():
|
||||
for key, value in most_recent_spawns.items():
|
||||
embed.add_field(
|
||||
name=key,
|
||||
value="\n".join(
|
||||
@ -49,12 +51,12 @@ class Tarkov(commands.Cog):
|
||||
inline=False,
|
||||
)
|
||||
|
||||
open("/tmp/boss_spawns.txt", "w").write(str(levels))
|
||||
open("/tmp/boss_spawns.txt", "w").write(str(most_recent_spawns))
|
||||
|
||||
await self.bot.get_channel(channel_id).send(embed=embed)
|
||||
|
||||
else:
|
||||
open("/tmp/boss_spawns.txt", "w").write(str(levels))
|
||||
open("/tmp/boss_spawns.txt", "w").write(str(most_recent_spawns))
|
||||
|
||||
async def get_all_bosses(ctx: discord.AutocompleteContext):
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user