How to send emoji in SendPhotoAsync()
Hello. I want to send emoji in SendPhotoAsync() can you help me? please give me this code, i tested anything but i can not send still.
Hi, To send Emoji no need that you use SendPhotoAsync(). you can use SendTextMessageAsync() and pass the Unicode of Emoji as message text. Also you can fine the complete Emoji Unicode Table here -> http://apps.timwhitlock.info/emoji/tables/unicode
Thank you but doesn work. this is my code : token.SendTextMessageAsync("MyChanell Id", "U+1F601", true, true, 0, null, ParseMode.Html);
Hello,
Search for "C# escape unicode", that should help. It's something like \u1060.
Kind regards, Martijn Verbakel
Try to use "\U0001F601" instead of your emoji's code. IntelliSense will remark it to you.
I used your suggestions but dont work!
For changing unicodes to emoji i use this function :
static string DecodeEncodedNonAsciiCharacters(string value)
{
return Regex.Replace(
value,
@"\u(?
It worked, first list is wrong as i see, because second list works fine with this function.
Hi, you said second list worked, but i can't find out which list worked? can you send an example? thanks in advance
I think he is referring to this list: http://apps.timwhitlock.info/emoji/tables/unicode
Which are then used as "My message \U0001F601" for sending.
token.SendTextMessageAsync("MyChanell Id", "My message \U0001F601", true, true, 0, null, ParseMode.Html);
Thanks for your help, but when i send "My message \U0001F601" as input to DecodeEncodedNonAsciiCharacters method, I receive Parsing Error so I've change the method like this:
static string DecodeEncodedNonAsciiCharacters2(string value)
{
return Regex.Replace(
value,
@"\\u(?<Value>[a-zA-Z0-9]{4})",
m =>
{
return ((char)int.Parse(m.Groups["Value"].Value, NumberStyles.HexNumber )).ToString();
});
}
So Second Method worked with that input, Any way Thank you.
You can find emoji code point list in https://emojipedia.org/telegram for example for Grinning Face With Smiling Eyes we use code point "U+1F601" this is "0x1F601" now for send text use below code: await Api.SendTextMessageAsync(message.Chat.Id, char.ConvertFromUtf32(0x1F601));
You can just write emojis in a string.
client.SendTextMessageAsync(chatId, "😄");
If you are running Windows 10, enable its touch keyboard and type emojis using that.
That's amazing answer it's work for me i want to send emoji on telegram bot using c# and i am visit this page i got my answer thanks a lot..