amsync/obj.py
async def chats(
        need_print:   bool       = False,
        ignore_ascii: bool       = False,
        com:          str | None = None
    ) -> dict[str, list[DataChat]]:
        """
        Returns the chats that you are in the community

        ### need_print
        Print the chats in a readable form

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

        if not (com := to_list(com or actual_com)):
            raise EmptyCom('Enter a com or send a message in a chat')

        async def foo(i):
            res = await _req(
                'get', f'x{i}/s/chat/thread?type=public-all&start=0&size=100'
            )
            return {str(i): [{'name': i['title'], 'id': i['threadId']} for i in res.json['threadList']]}

        a = await gather(*[foo(i) for i in com])
        chats = {k: v for i in a for k, v in i.items()}

        if need_print:
            for i, e in chats.items():
                max_name = len(
                    max(
                        [
                            i['name'] if not ignore_ascii else fix_ascii(i['name'])
                            for i in e
                        ],
                        key=len,
                    )
                )
                print(i)
                for n in e:
                    name = n['name'] if not ignore_ascii else fix_ascii(n['name'])
                    a = max_name - len(name)
                    print(f"    {name} {' '*a}-> {n['id']}")
                print()
        return [j for i in chats.values() for j in i]

        Returns the chats that you are in the community

        ### need_print
        Print the chats in a readable form

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

ignore_ascii
Removes special characters, which can disrupt the need_print
Returns the chats that you are in the community 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,
        com:          str | None = None
    ) -> dict[str, list[DataChat]]:
        if not (com := to_list(com or actual_com)):
            raise EmptyCom('Enter a com or send a message in a chat')
        async def foo(i):
            res = await _req(
                'get', f'x{i}/s/chat/thread?type=public-all&start=0&size=100'
            )
            return {str(i): [{'name': i['title'], 'id': i['threadId']} for i in res.json['threadList']]}
        a = await gather(*[foo(i) for i in com])
        chats = {k: v for i in a for k, v in i.items()}
        if need_print:
            for i, e in chats.items():
                max_name = len(
                    max(
                        [
                            i['name'] if not ignore_ascii else fix_ascii(i['name'])
                            for i in e
                        ],
                        key=len,
                    )
                )
                print(i)
                for n in e:
                    name = n['name'] if not ignore_ascii else fix_ascii(n['name'])
                    a = max_name - len(name)
                    print(f"    {name} {' '*a}-> {n['id']}")
                print()
        return [j for i in chats.values() for j in i]
async def chats ( need_print : bool = False , ignore_ascii : bool = False , com : str | None = None ) -> dict [ str , list [ DataChat ] ] : if not ( com := to_list ( com or actual_com ) ) : raise EmptyCom ( 'Enter a com or send a message in a chat' ) async def foo ( i ) : res = await _req ( 'get' , f'x{i}/s/chat/thread?type=public-all&start=0&size=100' ) return { str ( i ) : [ { 'name' : i [ 'title' ] , 'id' : i [ 'threadId' ] } for i in res . json [ 'threadList' ] ] } a = await gather ( * [ foo ( i ) for i in com ] ) chats = { k : v for i in a for k , v in i . items ( ) } if need_print : for i , e in chats . items ( ) : max_name = len ( max ( [ i [ 'name' ] if not ignore_ascii else fix_ascii ( i [ 'name' ] ) for i in e ] , key = len , ) ) print ( i ) for n in e : name = n [ 'name' ] if not ignore_ascii else fix_ascii ( n [ 'name' ] ) a = max_name - len ( name ) print ( f"    {name} {' '*a}-> {n['id']}" ) print ( ) return [ j for i in chats . values ( ) for j in i ]
Returns the chats that you are in the community
 need_print
Print the chats in a readable form
Returns the chats that you are in the community need_print Print the chats in a readable form
"""
        Returns the chats that you are in the community

        ### 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
com
str | None