【问题标题】:Send file by url telegram-api通过 url telegram-api 发送文件
【发布时间】:2022-01-03 03:41:48
【问题描述】:

如何设置通过 url 以电报形式发送的文件的名称?

new SendDocument()
                .setChatId(message.getChatId())
                .setDocument("https://www.okbhmao.ru/download.php?file=12021");

我想在电报聊天中发送此文件,名称为contract.pdf

【问题讨论】:

    标签: java telegram-bot


    【解决方案1】:

    我是这样解决的:

    new SendDocument()
                      .setChatId(message.getChatId())
                      .setDocument("contract.pdf", new URL("https://www.okbhmao.ru/download.php?file=12021").openStream());
    

    【讨论】:

    • 将您自己的答案标记为已接受,以便人们知道可以轻松找到它:)
    • @jwenting。您明天可以接受自己的答案;)
    猜你喜欢
    • 2021-05-09
    • 2019-08-23
    • 1970-01-01
    • 2016-05-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-18
    相关资源
    最近更新 更多