amsync/obj.py
async def load(filename: str) -> str:
        """
        Creates a chat containing the .json information created by Chat.save

        The name will be a uuid4 in the beginning for the program to identify the chat that was created,
        after that it will change to the correct name
        """

        with open(filename, 'r') as f:
            f = load(f)

        tmp_chat_name = str(uuid4())
        await Chat.create(
            name           = tmp_chat_name,
            text           = f['text'],
            bg             = f['bg'],
            icon           = f['icon'],
            only_fans      = f['only_fans'],
            invite_members = f['members']
        )

        chats = await Community.chats()
        names = [i['name'] for i in chats]
        ids   = [i['id'] for i in chats]
        chat  = ids[names.index(tmp_chat_name)]

        await Chat.edit(
            name               = f['name'],
            pin                = f['is_pinned'],
            announcement       = f['announcement'],
            only_view          = f['only_view'],
            members_can_invite = f['members_can_invite'],
            can_send_coins     = f['can_send_coins'],
            change_adm_to      = f['adm'] if f['adm'] != bot_id else None,
            chat               = chat
        )

        await Chat.change_co_hosts(f['co_hosts'])
        return chat

        Creates a chat containing the .json information created by Chat.save

        The name will be a uuid4 in the beginning for the program to identify the chat that was created,
        after that it will change to the correct name
        
Creates a chat containing the .json information created by Chat.save
The name will be a uuid4 in the beginning for the program to identify the chat that was created,
after that it will change to the correct name
Creates a chat containing the . json information created by Chat . save The name will be a uuid4 in the beginning for the program to identify the chat that was created after that it will change to the correct name
async def load(filename: str) -> str:
        with open(filename, 'r') as f:
            f = load(f)
        tmp_chat_name = str(uuid4())
        await Chat.create(
            name           = tmp_chat_name,
            text           = f['text'],
            bg             = f['bg'],
            icon           = f['icon'],
            only_fans      = f['only_fans'],
            invite_members = f['members']
        )
        chats = await Community.chats()
        names = [i['name'] for i in chats]
        ids   = [i['id'] for i in chats]
        chat  = ids[names.index(tmp_chat_name)]
        await Chat.edit(
            name               = f['name'],
            pin                = f['is_pinned'],
            announcement       = f['announcement'],
            only_view          = f['only_view'],
            members_can_invite = f['members_can_invite'],
            can_send_coins     = f['can_send_coins'],
            change_adm_to      = f['adm'] if f['adm'] != bot_id else None,
            chat               = chat
        )
        await Chat.change_co_hosts(f['co_hosts'])
        return chat
async def load ( filename : str ) -> str : with open ( filename , 'r' ) as f : f = load ( f ) tmp_chat_name = str ( uuid4 ( ) ) await Chat . create ( name = tmp_chat_name , text = f [ 'text' ] , bg = f [ 'bg' ] , icon = f [ 'icon' ] , only_fans = f [ 'only_fans' ] , invite_members = f [ 'members' ] ) chats = await Community . chats ( ) names = [ i [ 'name' ] for i in chats ] ids = [ i [ 'id' ] for i in chats ] chat = ids [ names . index ( tmp_chat_name ) ] await Chat . edit ( name = f [ 'name' ] , pin = f [ 'is_pinned' ] , announcement = f [ 'announcement' ] , only_view = f [ 'only_view' ] , members_can_invite = f [ 'members_can_invite' ] , can_send_coins = f [ 'can_send_coins' ] , change_adm_to = f [ 'adm' ] if f [ 'adm' ] != bot_id else None , chat = chat ) await Chat . change_co_hosts ( f [ 'co_hosts' ] ) return chat
Creates a chat containing the .json information created by Chat.save
The name will be a uuid4 in the beginning for the program to identify the chat that was created,
after that it will change to the correct name
Creates a chat containing the . json information created by Chat . save The name will be a uuid4 in the beginning for the program to identify the chat that was created after that it will change to the correct name
"""
        Creates a chat containing the .json information created by Chat.save

        The name will be a uuid4 in the beginning for the program to identify the chat that was created,
        after that it will change to the correct name
        """
filename
str