11using Telegram . Bot ;
22using Telegram . Bot . Exceptions ;
3+ using Telegram . Bot . Extensions ;
34using Telegram . Bot . Polling ;
45using Telegram . Bot . Types ;
56using Telegram . Bot . Types . Enums ;
@@ -56,6 +57,8 @@ private async Task OnMessage(Message msg)
5657 "/inline_mode" => StartInlineQuery ( msg ) ,
5758 "/poll" => SendPoll ( msg ) ,
5859 "/poll_anonymous" => SendAnonymousPoll ( msg ) ,
60+ "/reaction" => SendReaction ( msg ) ,
61+ "/html" => SendViaHtml ( msg ) ,
5962 "/throw" => FailingHandler ( msg ) ,
6063 _ => Usage ( msg )
6164 } ) ;
@@ -74,6 +77,8 @@ async Task<Message> Usage(Message msg)
7477 /inline_mode - send inline-mode results list
7578 /poll - send a poll
7679 /poll_anonymous - send an anonymous poll
80+ /reaction - send a reaction
81+ /html [html] - send a message with SendHtml tags
7782 /throw - what happens if handler fails
7883 """ ;
7984 return await bot . SendMessage ( msg . Chat , usage , parseMode : ParseMode . Html , replyMarkup : new ReplyKeyboardRemove ( ) ) ;
@@ -133,7 +138,20 @@ async Task<Message> SendPoll(Message msg)
133138
134139 async Task < Message > SendAnonymousPoll ( Message msg )
135140 {
136- return await bot . SendPoll ( chatId : msg . Chat , "Question" , PollOptions ) ;
141+ return await bot . SendPoll ( msg . Chat , "Question" , PollOptions ) ;
142+ }
143+
144+ async Task < Message > SendReaction ( Message msg )
145+ {
146+ await bot . SetMessageReaction ( msg . Chat , msg . Id , [ "❤" ] , false ) ;
147+ return msg ;
148+ }
149+
150+ async Task < Message > SendViaHtml ( Message msg )
151+ {
152+ var space = msg . Text ? . IndexOf ( ' ' ) ?? - 1 ;
153+ if ( space == - 1 ) return await bot . SendMessage ( msg . Chat , "Usage: /html [html]" ) ;
154+ return ( await bot . SendHtml ( msg . Chat , msg . Text ! [ ( space + 1 ) ..] ) ) [ 0 ] ;
137155 }
138156
139157 static Task < Message > FailingHandler ( Message msg )
0 commit comments