如何在C#中使用TLsharp API发送多行消息?

时间:2018-01-31 16:17:53

标签: c# sharp

我想在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");


    }   

1 个答案:

答案 0 :(得分:0)

哦,非常简单,只是:

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");