TLSharp library able to send message with "bold", "italic"?

175 views Asked by At

I able to send telegram message by using TLsharp library. My question is how to set my message to bold, italic?

1

There are 1 answers

0
Daniel Caraça On

TlSharp SendMessageAsync method don´t have it implemented.

Alter to accept a 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);
}

and call it defining what you want

Bold:

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

Italic:

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