Fix time for job
First pass at boss spawn monitoring fix channel id
This commit is contained in:
parent
74729a101f
commit
b294ac83dd
@ -10,9 +10,11 @@ import requests
|
|||||||
import tarkov
|
import tarkov
|
||||||
|
|
||||||
if os.getenv("DRAGON_ENV") == "prod":
|
if os.getenv("DRAGON_ENV") == "prod":
|
||||||
channel_id = 1097567909640929340
|
channel_id = 815310511776202773
|
||||||
|
time_limit = 600
|
||||||
else:
|
else:
|
||||||
channel_id = 932476007439552522
|
channel_id = 932476007439552522
|
||||||
|
time_limit = 10
|
||||||
|
|
||||||
|
|
||||||
class Tarkov(commands.Cog):
|
class Tarkov(commands.Cog):
|
||||||
@ -22,25 +24,25 @@ class Tarkov(commands.Cog):
|
|||||||
|
|
||||||
tarkov = discord.SlashCommandGroup("tarkov", "Tarkov related commands")
|
tarkov = discord.SlashCommandGroup("tarkov", "Tarkov related commands")
|
||||||
|
|
||||||
@tasks.loop(seconds=10)
|
@tasks.loop(seconds=time_limit)
|
||||||
async def check_boss_spawns(self):
|
async def check_boss_spawns(self):
|
||||||
# Wait until the bot is ready before we actually start executing code
|
# Wait until the bot is ready before we actually start executing code
|
||||||
await self.bot.wait_until_ready()
|
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"):
|
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")
|
print("Boss spawns have changed")
|
||||||
|
|
||||||
embed = discord.Embed(
|
embed = discord.Embed(
|
||||||
description="-------", color=discord.Color.blue(), type="rich"
|
description="-------", color=discord.Color.blue(), type="rich"
|
||||||
)
|
)
|
||||||
embed.set_author(name="🎲 Boss Spawns have updated 🎲")
|
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(
|
embed.add_field(
|
||||||
name=key,
|
name=key,
|
||||||
value="\n".join(
|
value="\n".join(
|
||||||
@ -49,12 +51,12 @@ class Tarkov(commands.Cog):
|
|||||||
inline=False,
|
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)
|
await self.bot.get_channel(channel_id).send(embed=embed)
|
||||||
|
|
||||||
else:
|
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):
|
async def get_all_bosses(ctx: discord.AutocompleteContext):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user