【问题标题】:How to use TLsharp API in C# to send a multi-line message?如何在 C# 中使用 TLsharp API 发送多行消息?
【发布时间】:2018-07-10 19:58:36
【问题描述】:

我想在 C# 中使用 Telegram API 向频道发送多行消息。我使用 TLsharp,但无法发送表情符号和多行消息。

谁能给我一个密码?

private async void button3_Click(object sender, EventArgs e)
    {
        if (client.IsUserAuthorized()) { MessageBox.Show("You Logined!"); };
            var dialogs = (TLDialogs)await client.GetUserDialogsAsync();
        var chat = dialogs.chats.lists
            .OfType<TLChannel>()
            .SingleOrDefault(a => a.title == "AliGol");
        await client.SendMessageAsync(new TLInputPeerChannel() { channel_id = chat.id, access_hash = chat.access_hash.Value }, "OUR_MESSAGE");
        var fileResult = await client.UploadFile("C:\\a\\ali.jpg", new StreamReader("data/ali.jpg"));
        await client.SendUploadedPhoto(new TLInputPeerChannel() { channel_id = chat.id, access_hash = chat.access_hash.Value }, fileResult, "MultiLine Message");


    }   

【问题讨论】:

    标签: c# sharp


    【解决方案1】:

    哦,很简单,只是:

    await client.SendUploadedPhoto(new TLInputPeerChannel() { channel_id = chat.id, access_hash = chat.access_hash.Value }, fileResult, "New line" + Environment.NewLine + "another line"); or             ("this is first line" + "\n" + "this is second line");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-04-06
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      • 2012-09-17
      • 1970-01-01
      • 2011-07-25
      • 2020-08-31
      相关资源
      最近更新 更多