【问题标题】:How can I send photo to telegram user with telethon如何使用 Telethon 将照片发送给电报用户
【发布时间】:2020-09-17 08:58:03
【问题描述】:

目前我正在使用这种向用户发送文本的方法,但是如何使用 Telethon 模块向用户发送照片

client.send_message(receiver, message.format(user['name'])

【问题讨论】:

  • 你看过 Telethons Documentaton for the Client 吗?它有名为“send_file”和“upload_file”的方法,可能会对您有所帮助。

标签: python telegram sendmessage telethon


【解决方案1】:

正如@vlz 在评论中所说,client.send_file listed in the documentation 是正确的使用方法:

# note: local paths work just as well
# note: await is needed if used inside async def
await client.send_file(receiver, '/path/to/photo.jpg')

【讨论】:

    猜你喜欢
    • 2016-07-18
    • 1970-01-01
    • 2020-09-06
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    • 2017-12-05
    • 2020-03-06
    • 2016-08-15
    相关资源
    最近更新 更多