0

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


    }   
4

1 回答 1

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");
于 2018-02-01T04:48:05.977 回答