1

我可以使用 TLsharp 库发送电报消息。我的问题是如何将我的消息设置为粗体、斜体?

4

1 回答 1

1

TlSharp SendMessageAsync 方法没有实现。

更改以接受 TLVector

public async Task<TLAbsUpdates> SendMessageAsync(TLAbsInputPeer peer, string message, TLVector<TLAbsMessageEntity> vEntity = null, CancellationToken token = default(CancellationToken))
{
    return await SendAuthenticatedRequestAsync<TLAbsUpdates>(new TLRequestSendMessage()
                 {
                     Peer = peer,
                     Message = message,
                     RandomId = Helpers.GenerateRandomLong(),
                     Entities = vEntity
                 }, token)
                .ConfigureAwait(false);
}

并称之为定义你想要的

大胆的:

var bold = new TLMessageEntityBold();
bold.Length = 5;
bold.Offset = 0;
SendMessageAsync(peer, message, new TLVector<TLAbsMessageEntity>() { bold });

斜体:

var italic = new TLMessageEntityItalic();
italic .Length = 5;
italic .Offset = 0;
SendMessageAsync(peer, message, new TLVector<TLAbsMessageEntity>() { italic });
于 2021-02-10T17:19:57.977 回答