Save&load different files
This commit is contained in:
parent
d41eb3fc4c
commit
9c041387d1
|
@ -187,15 +187,17 @@ async def on_ready():
|
|||
|
||||
@bot.command(help="Sauvegarde la partie")
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def save(ctx: commands.Context):
|
||||
Game.INSTANCE.save('game.save')
|
||||
async def save(ctx: commands.Context, filename: str = 'game.save'):
|
||||
Game.INSTANCE.save(filename)
|
||||
await ctx.reply("La partie a été sauvegardée.")
|
||||
|
||||
|
||||
@bot.command(help="Recharger la partie")
|
||||
@commands.has_permissions(administrator=True)
|
||||
async def load(ctx: commands.Context):
|
||||
Game.load('game.save')
|
||||
async def load(ctx: commands.Context, filename: str = 'game.save'):
|
||||
game = Game.load(filename)
|
||||
if not game:
|
||||
return await ctx.reply("Une erreur est survenue : le fichier n'existe pas ?")
|
||||
await ctx.reply("La partie a été rechargée.")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue