amsync/obj.py
async def chats(
        need_print:   bool = False,
        ignore_ascii: bool = False
    ) -> dict[str, list[str, list[str]]]:
        """
        Returns chats in which you are from all communities

        ### need_print
        Print the chats in a readable form

        ### ignore_ascii
        Removes special characters, which can disrupt the need_print
        """

        res = await _req('get', 'g/s/community/joined?v=1&start=0&size=50')
        coms = {str(i['ndcId']): [i['name'], []] for i in res.json['communityList']}

        async def foo(i):
            return (await _req(
                'get', f'x{i}/s/chat/thread?type=joined-me&start=0&size=100'
            )).json

        chats = await gather(*[foo(i) for i in coms])

        for i in chats:
            for j in i['threadList']:
                com_id = str(j['ndcId'])
                chat_id = j['threadId']
                is_private_chat = j['membersQuota'] == 2
                chat_name = (
                    j['membersSummary'][1]['nickname']
                    if is_private_chat
                    else j['title']
                )

                coms[com_id][1].append(
                    (
                        chat_name if not ignore_ascii else fix_ascii(chat_name),
                        chat_id,
                    )
                )

        if need_print:
            for i, e in coms.items():
                max_name = (
                    len(max([i[0] for i in e[1]], key=len)) if e[1] else 0
                )
                print(f'{coms[i][0]} - {i}')
                for j in coms[i][1]:
                    a = (max_name - len(j[0])) + 1
                    print(f'    {j[0]} {" "*a}-> {j[1]}')
                print()

        return [j for i in list(coms.values()) for j in i[1]]

        Returns chats in which you are from all communities

        ### need_print
        Print the chats in a readable form

        ### ignore_ascii
        Removes special characters, which can disrupt the need_print
        
Returns chats in which you are from all communities
need_print
Print the chats in a readable form

ignore_ascii
Removes special characters, which can disrupt the need_print
Returns chats in which you are from all communities need_print Print the chats in a readable form ignore_ascii Removes special characters which can disrupt the need_print
async def chats(
        need_print:   bool = False,
        ignore_ascii: bool = False
    ) -> dict[str, list[str, list[str]]]:
        res = await _req('get', 'g/s/community/joined?v=1&start=0&size=50')
        coms = {str(i['ndcId']): [i['name'], []] for i in res.json['communityList']}
        async def foo(i):
            return (await _req(
                'get', f'x{i}/s/chat/thread?type=joined-me&start=0&size=100'
            )).json
        chats = await gather(*[foo(i) for i in coms])
        for i in chats:
            for j in i['threadList']:
                com_id = str(j['ndcId'])
                chat_id = j['threadId']
                is_private_chat = j['membersQuota'] == 2
                chat_name = (
                    j['membersSummary'][1]['nickname']
                    if is_private_chat
                    else j['title']
                )
                coms[com_id][1].append(
                    (
                        chat_name if not ignore_ascii else fix_ascii(chat_name),
                        chat_id,
                    )
                )
        if need_print:
            for i, e in coms.items():
                max_name = (
                    len(max([i[0] for i in e[1]], key=len)) if e[1] else 0
                )
                print(f'{coms[i][0]} - {i}')
                for j in coms[i][1]:
                    a = (max_name - len(j[0])) + 1
                    print(f'    {j[0]} {" "*a}-> {j[1]}')
                print()
        return [j for i in list(coms.values()) for j in i[1]]
async def chats ( need_print : bool = False , ignore_ascii : bool = False ) -> dict [ str , list [ str , list [ str ] ] ] : res = await _req ( 'get' , 'g/s/community/joined?v=1&start=0&size=50' ) coms = { str ( i [ 'ndcId' ] ) : [ i [ 'name' ] , [ ] ] for i in res . json [ 'communityList' ] } async def foo ( i ) : return ( await _req ( 'get' , f'x{i}/s/chat/thread?type=joined-me&start=0&size=100' ) ) . json chats = await gather ( * [ foo ( i ) for i in coms ] ) for i in chats : for j in i [ 'threadList' ] : com_id = str ( j [ 'ndcId' ] ) chat_id = j [ 'threadId' ] is_private_chat = j [ 'membersQuota' ] == 2 chat_name = ( j [ 'membersSummary' ] [ 1 ] [ 'nickname' ] if is_private_chat else j [ 'title' ] ) coms [ com_id ] [ 1 ] . append ( ( chat_name if not ignore_ascii else fix_ascii ( chat_name ) , chat_id , ) ) if need_print : for i , e in coms . items ( ) : max_name = ( len ( max ( [ i [ 0 ] for i in e [ 1 ] ] , key = len ) ) if e [ 1 ] else 0 ) print ( f'{coms[i][0]} - {i}' ) for j in coms [ i ] [ 1 ] : a = ( max_name - len ( j [ 0 ] ) ) + 1 print ( f'    {j[0]} {" "*a}-> {j[1]}' ) print ( ) return [ j for i in list ( coms . values ( ) ) for j in i [ 1 ] ]
Returns chats in which you are from all communities
 need_print
Print the chats in a readable form
Returns chats in which you are from all communities need_print Print the chats in a readable form
"""
        Returns chats in which you are from all communities

        ### need_print
        Print the chats in a readable form

        ### ignore_ascii
        Removes special characters, which can disrupt the need_print
        """
need_print
bool
ignore_ascii
bool