Save&load different files
This commit is contained in:
		@@ -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.")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user