0

我不知道我做错了什么,请帮我解决这个问题...... 我正在尝试构建一个电报机器人,并在许多 github 研究的帮助下,我想出了这段代码。但我正面临这个错误,请帮助解决它。

from telethon import TelegramClient, connection
import logging
from telethon import sync, TelegramClient, events
import json

with open('config.json', 'r') as f:
    config = json.loads(f.read())

logging.basicConfig(level=logging.WARNING)

accounts = config['accounts']

folder_session = 'session/'

for account in accounts:
    api_id = account['api_id']
    api_hash = account['api_hash']
    phone = account['phone']
    print(phone)

    client = TelegramClient(folder_session + phone, api_id, api_hash)
    client.start()
    if client.is_user_authorized():
        print('Login success')
    else:
        print('Login fail')
    client.disconnect()

_________________________________________________________________________________________________*
 

 OperationalError                          Traceback (most recent call last)
<ipython-input-3-dd3766aaae79> in <module>
     19         print(phone)
     20 
---> 21         client = TelegramClient(folder_session + phone, api_id, api_hash)
     22         client.start()
     23         if client.is_user_authorized():
4

1 回答 1

0

您只需要在该 Python 文件的同一目录中创建一个名为session的文件夹。

于 2021-08-17T22:45:58.267 回答