mirror of
https://github.com/Ryujinx/ryuko-ng.git
synced 2025-08-04 18:31:08 +00:00
robocronp: send data files hourly
This aims to reduce data loss Also, stopped calling these config files and started calling them data files
This commit is contained in:
parent
f637e646fd
commit
1cc8c9a9ee
|
@ -103,6 +103,7 @@ Main goal of this project is to get Robocop functionality done, secondary goal i
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
[ ] Reduce code repetition on mod_timed.py
|
[ ] Reduce code repetition on mod_timed.py
|
||||||
|
[ ] Allow non-hour values on timed bans
|
||||||
|
|
||||||
the following require me to rethink some of the lockdown code, which I don't feel like
|
the following require me to rethink some of the lockdown code, which I don't feel like
|
||||||
|
|
||||||
|
|
|
@ -93,8 +93,8 @@ async def on_ready():
|
||||||
msg = f"{bot.user.name} has started! "\
|
msg = f"{bot.user.name} has started! "\
|
||||||
f"{guild.name} has {guild.member_count} members!"
|
f"{guild.name} has {guild.member_count} members!"
|
||||||
|
|
||||||
config_files = [discord.File(fpath) for fpath in wanted_jsons]
|
data_files = [discord.File(fpath) for fpath in wanted_jsons]
|
||||||
await log_channel.send(msg, files=config_files)
|
await log_channel.send(msg, files=data_files)
|
||||||
|
|
||||||
await bot.change_presence(activity=discord.Game(name=game_name))
|
await bot.change_presence(activity=discord.Game(name=game_name))
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ class Admin:
|
||||||
@commands.command()
|
@commands.command()
|
||||||
async def fetchdata(self, ctx):
|
async def fetchdata(self, ctx):
|
||||||
"""Returns data files"""
|
"""Returns data files"""
|
||||||
config_files = [discord.File(fpath) for fpath in self.bot.wanted_jsons]
|
data_files = [discord.File(fpath) for fpath in self.bot.wanted_jsons]
|
||||||
await ctx.send("Here you go:", files=config_files)
|
await ctx.send("Here you go:", files=data_files)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.check(check_if_bot_manager)
|
@commands.check(check_if_bot_manager)
|
||||||
|
|
|
@ -12,7 +12,12 @@ class Robocronp:
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
self.bot = bot
|
self.bot = bot
|
||||||
bot.loop.create_task(self.minutely())
|
bot.loop.create_task(self.minutely())
|
||||||
# bot.loop.create_task(self.hourly())
|
bot.loop.create_task(self.hourly())
|
||||||
|
|
||||||
|
async def send_data(self):
|
||||||
|
data_files = [discord.File(fpath) for fpath in self.bot.wanted_jsons]
|
||||||
|
log_channel = self.bot.get_channel(config.log_channel)
|
||||||
|
await log_channel.send("Hourly data backups:", files=data_files)
|
||||||
|
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@commands.check(check_if_staff)
|
@commands.check(check_if_staff)
|
||||||
|
@ -81,11 +86,19 @@ class Robocronp:
|
||||||
pass
|
pass
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
# async def hourly(self):
|
async def hourly(self):
|
||||||
# await self.bot.wait_until_ready()
|
await self.bot.wait_until_ready()
|
||||||
# while not self.bot.is_closed():
|
while not self.bot.is_closed():
|
||||||
# # Your stuff goes here
|
# Your stuff that should run at boot
|
||||||
# await asyncio.sleep(3600)
|
# and after that every hour goes here
|
||||||
|
await asyncio.sleep(3600)
|
||||||
|
try:
|
||||||
|
await self.send_data()
|
||||||
|
except:
|
||||||
|
# Don't kill cronjobs if something goes wrong.
|
||||||
|
pass
|
||||||
|
# Your stuff that should run an hour after boot
|
||||||
|
# and after that every hour goes here
|
||||||
|
|
||||||
|
|
||||||
def setup(bot):
|
def setup(bot):
|
||||||
|
|
Loading…
Reference in a new issue