В файле JSON добавилась информация,но при перезагрузки бота данные не сохраняются

@bot.command()
@commands.has_permissions(administrator = True)
async def lang(ctx, mean, lang):
       with open("langs.json", "r") as f:
            langs = json.load(f)
       langs[str(ctx.guild.id)] = lang
       with open("langs.json", "w") as f:
            json.dump(langs, f)
       if mean == 'ru':
           for filename in os.listdir('./cog_ru'):
               if filename.endswith('.py'):
                   bot.load_extension(f'cog_ru.{filename[:-3]}')
           Russian = discord.Embed(title='Успех!', description='Язык изменён на Русский', color=0x00ff00)
           Russian.set_footer(text='MBK 2023, Все права защищены!')      
           await ctx.channel.send(embed=Russian)
       else:
           for filename in os.listdir('./cog_en'):
               if filename.endswith('.py'):
                   bot.load_extension(f'cog_en.{filename[:-3]}')
           English = discord.Embed(title='Success!', description='language changed to English', color=0x00ff00)
           English.set_footer(text='MBK 2023, all rights reserved!')
           await ctx.channel.send(embed=English)

введите сюда описание изображения


Ответы (0 шт):