python 3的全功能telegram客户端库

TelethonGoblenusTest的Python项目详细描述


⭐️ Thanks everyone who has starred the project, it means a lot!

TelethonPython 3中的电报客户端实现,它使用 最新可用的电报API请记住使用pip3安装!

安装

pip install telethon

创建客户端

fromtelethonimportTelegramClient# 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=12345api_hash='0123456789abcdef0123456789abcdef'phone='+34600000000'client=TelegramClient('session_name',api_id,api_hash)client.connect()# If you already have a previous 'session_name.session' file, skip this.client.sign_in(phone=phone)me=client.sign_in(code=77777)# Put whatever code you received here.

做事

print(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)total,messages,senders=client.get_message_history('username')client.download_media(messages[0])

下一步

你喜欢Telethon的样子吗?检查 wiki over GitHub对于 更深入的解释、示例、疑难解答等 有用的信息。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用java向dropup html/css添加项目   如何从java中的向量向量打印   Java Maven库项目模板   java使用atmosphere api还是直接使用grizzly?   java JComponent仅部分显示   如何将动态值传递给自定义注释,以从Java数据进行映射。性质   java破解已实现方法的返回类型的最佳方法?   java Netbeans在JFrame Gui布局中覆盖图像   spring java仅向登录用户显示注销按钮   java如何对com进行身份验证。谷歌。云bigquery。带有服务帐户的BigQuery`   java禁止空字符串参数和抛出RuntimeException以阻止方法继续的利弊   java分析项目中的所有JAR以获取版本和许可证信息   Java,数据库为什么要分配一个新对象,而我们可以直接将它放入数据库