Github: https://github.com/LonamiWebs/Telethon
Telethon
⭐ プロジェクトに主演してくれた皆さん、ありがとうございます 。
TelethonはTelegramの最新の利用可能なAPIを使用するPython 3の Telegramクライアント実装です。
これは何ですか?
テレグラムは一般的なメッセージングアプリケーションです。 このライブラリは、Telegramと対話できるPythonプログラムを簡単に作成できるようにするためのものです。 それはすでにあなたのために重い仕事をしているラッパーと考えるので、アプリケーションの開発に集中することができます。
インストール
pip3 install telethon
クライアントの作成
from telethon import TelegramClient
# These example values won't work. You must get your own api_id and
# api_hash from https://my.telegram.org, under API Development.
api_id = 12345
api_hash = '0123456789abcdef0123456789abcdef'
client = TelegramClient('session_name', api_id, api_hash)
client.start()
物事をする
print(client.get_me().stringify())
client.send_message('username', 'Hello! Talking to you from Telethon')
client.send_file('username', '/home/myself/Pictures/holidays.jpg')
client.download_profile_photo('me')
messages = client.get_message_history('username')
client.download_media(messages[0])
次のステップ
あなたはTelethonの見た目が好きですか? サンプルを読んで、例、トラブルシューティングの問題、およびより有用な情報など、より詳細な説明を確認してください。