File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed
Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change 33 <PropertyGroup >
44 <Description >Telegram Bot API library</Description >
55 <AssemblyTitle >NetTelegramBotApi</AssemblyTitle >
6- <VersionPrefix >4.1 .0</VersionPrefix >
6+ <Version >4.2 .0</Version >
77 <TargetFrameworks >net45;net46;netstandard1.3</TargetFrameworks >
88 <NetStandardImplicitPackageVersion >1.6.0</NetStandardImplicitPackageVersion >
99 <AssemblyName >NetTelegramBotApi</AssemblyName >
1010 <PackageId >NetTelegramBotApi</PackageId >
1111 <PackageTags >telegram;bot;api</PackageTags >
12- <PackageReleaseNotes >See https://github.com/justdmitry/NetTelegramBotApi/releases/tag/v4.0 .0</PackageReleaseNotes >
12+ <PackageReleaseNotes >See https://github.com/justdmitry/NetTelegramBotApi/releases/tag/v4.2 .0</PackageReleaseNotes >
1313 <PackageIconUrl >https://raw.githubusercontent.com/justdmitry/NetTelegramBotApi/master/package-icon.gif</PackageIconUrl >
1414 <PackageProjectUrl >https://github.com/justdmitry/NetTelegramBotApi</PackageProjectUrl >
1515 <RepositoryType >git</RepositoryType >
Original file line number Diff line number Diff line change 1+ namespace System
2+ {
3+ using System . Text . RegularExpressions ;
4+
5+ public static class StringExtensions
6+ {
7+ private static readonly Regex WrongChars = new Regex ( @"([\*_`\[\]\(\)])" ) ;
8+
9+ public static string MarkdownEncode ( this string value )
10+ {
11+ if ( string . IsNullOrWhiteSpace ( value ) )
12+ {
13+ return value ;
14+ }
15+
16+ return WrongChars . Replace ( value , @"\$1" ) ;
17+ }
18+ }
19+ }
Original file line number Diff line number Diff line change @@ -200,7 +200,7 @@ public static void RunBot(string accessToken)
200200 {
201201 bot . MakeRequestAsync ( new SendMessage (
202202 update . Message . Chat . Id ,
203- "You wrote * " + update . Message . Text . Length + " characters*" )
203+ "You wrote: \r \n " + update . Message . Text . MarkdownEncode ( ) )
204204 {
205205 ParseMode = SendMessage . ParseModeEnum . Markdown
206206 } ) . Wait ( ) ;
Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ public static void RunBot(string accessToken)
171171 {
172172 bot . MakeRequestAsync ( new SendMessage (
173173 update . Message . Chat . Id ,
174- "You wrote * " + update . Message . Text . Length + " characters* " )
174+ "You wrote: \r \n _ " + update . Message . Text . MarkdownEncode ( ) + "_ " )
175175 {
176176 ParseMode = SendMessage . ParseModeEnum . Markdown
177177 } ) . Wait ( ) ;
You can’t perform that action at this time.
0 commit comments