11import logging
22from pathlib import Path
33
4+ from apscheduler .schedulers .asyncio import AsyncIOScheduler
45from dis_snek .client import Snake
56from dis_snek .errors import CommandCheckFailure
67from dis_snek .mixins .send import SendMixin
@@ -53,6 +54,11 @@ async def sync(self, ctx: MessageContext):
5354 await bot .synchronise_interactions ()
5455 await sync_msg .edit ("Syncing done!" )
5556
57+ @message_command ("data_download" )
58+ # @check(has_role(BOT_DEV_ROLE))
59+ async def data_download (self , ctx : MessageContext ):
60+ await ctx .send ("Here is the data!" , file = self .storage .filename )
61+
5662 @slash_command ("help" , "Basic instructions and what this bot is." )
5763 async def help (self , ctx : InteractionContext ):
5864 embed = Embed (
@@ -71,6 +77,11 @@ async def on_command_error(self, source: str, error: Exception, *args, **kwargs)
7177
7278
7379bot = BytehackzBot (default_prefix = "!" , debug_scope = GUILD )
74- bot .storage = JsonStorage (bot , "data.json" )
80+
81+ bot .storage = JsonStorage ("data.json" , "./backup" , 20 )
82+ scheduler = AsyncIOScheduler ()
83+ scheduler .add_job (bot .storage .backup , 'interval' , minutes = 5 )
84+ scheduler .start ()
85+
7586bot .load_all_scales ("modules" )
7687bot .start (TOKEN )
0 commit comments