@@ -228,72 +228,73 @@ namespace ReplyMarkups
228228 {
229229 public partial class ReplyKeyboardMarkup
230230 {
231- /// <summary>Initializes a new instance of <see cref="ReplyKeyboardMarkup"/> with one button</summary>
231+ /// <summary>Creates a <see cref="ReplyKeyboardMarkup"/> with one button</summary>
232232 /// <param name="button">Button or text on keyboard</param>
233233 [ SetsRequiredMembers ]
234- public ReplyKeyboardMarkup ( KeyboardButton button ) : this ( new List < List < KeyboardButton > > { new ( ) { button } } ) { }
234+ public ReplyKeyboardMarkup ( KeyboardButton button ) => Keyboard = new List < List < KeyboardButton > > { new ( ) { button } } ;
235235
236- /// <summary>Initializes a new instance of <see cref="ReplyKeyboardMarkup"/></summary>
237- /// <param name="keyboardRow">The keyboard row. </param>
236+ /// <summary>Creates a <see cref="ReplyKeyboardMarkup"/> with multiple buttons on one row </summary>
237+ /// <param name="keyboardRow">Reply keyboard buttons </param>
238238 [ SetsRequiredMembers ]
239- public ReplyKeyboardMarkup ( IEnumerable < KeyboardButton > keyboardRow ) : this ( new List < List < KeyboardButton > > { keyboardRow . ToList ( ) } ) { }
239+ public ReplyKeyboardMarkup ( params KeyboardButton [ ] keyboardRow ) => Keyboard = new List < List < KeyboardButton > > { keyboardRow . ToList ( ) } ;
240240
241- #pragma warning disable MA0016 // Prefer using collection abstraction instead of implementation
242- /// <summary>Initializes a new instance of <see cref="ReplyKeyboardMarkup"/></summary>
243- /// <param name="keyboardRow">The keyboard row.</param>
241+ /// <summary>Creates a <see cref="ReplyKeyboardMarkup"/> with multiple buttons on one row</summary>
242+ /// <param name="keyboardRow">Reply keyboard buttons</param>
244243 [ SetsRequiredMembers ]
245- public ReplyKeyboardMarkup ( List < KeyboardButton > keyboardRow ) : this ( new List < List < KeyboardButton > > { keyboardRow } ) { }
246- #pragma warning restore MA0016 // Prefer using collection abstraction instead of implementation
244+ public ReplyKeyboardMarkup ( IEnumerable < KeyboardButton > keyboardRow ) => Keyboard = new List < List < KeyboardButton > > { keyboardRow . ToList ( ) } ;
247245
248- /// <summary>Initializes a new instance of <see cref="ReplyKeyboardMarkup"/></summary>
249- /// <param name="keyboardRow">A row of buttons or texts.</param>
246+ #pragma warning disable MA0016 // Prefer using collection abstraction instead of implementation
247+ /// <summary>Creates a <see cref="ReplyKeyboardMarkup"/> with multiple buttons on one row</summary>
248+ /// <param name="keyboardRow">Reply keyboard buttons</param>
250249 [ SetsRequiredMembers ]
251- public ReplyKeyboardMarkup ( params KeyboardButton [ ] keyboardRow ) : this ( new List < List < KeyboardButton > > { keyboardRow . ToList ( ) } ) { }
250+ public ReplyKeyboardMarkup ( List < KeyboardButton > keyboardRow ) => Keyboard = new List < List < KeyboardButton > > { keyboardRow } ;
251+ #pragma warning restore MA0016 // Prefer using collection abstraction instead of implementation
252252
253253 /// <summary>Instantiates a new <see cref="ReplyKeyboardMarkup"/></summary>
254+ /// <param name="resizeKeyboard">Request to resize the keyboard vertically for optimal fit</param>
254255 [ SetsRequiredMembers ]
255256 public ReplyKeyboardMarkup ( bool resizeKeyboard ) : this ( ) => ResizeKeyboard = resizeKeyboard ;
256257
257258 /// <summary>Generates a reply keyboard markup with one button</summary>
258- /// <param name="text">Button's text</param>
259+ /// <param name="text">Button text</param>
259260 [ return : NotNullIfNotNull ( nameof ( text ) ) ]
260261 public static implicit operator ReplyKeyboardMarkup ? ( string ? text ) => text is null ? default : new ( text ) ;
261262
262263 /// <summary>Generates a reply keyboard markup with multiple buttons on one row</summary>
263- /// <param name="texts">Texts of buttons </param>
264+ /// <param name="texts">Buttons text </param>
264265 [ return : NotNullIfNotNull ( nameof ( texts ) ) ]
265266 public static implicit operator ReplyKeyboardMarkup ? ( string [ ] ? texts ) => texts is null ? default : new [ ] { texts } ;
266267
267- /// <summary>Generates a reply keyboard markup with multiple buttons</summary>
268- /// <param name="texts">Texts of buttons</param>
269- [ return : NotNullIfNotNull ( nameof ( texts ) ) ]
270- public static implicit operator ReplyKeyboardMarkup ? ( string [ ] [ ] ? texts ) => texts is null ? default
271- : new ReplyKeyboardMarkup ( texts . Select ( texts => texts . Select ( t => new KeyboardButton ( t ) ) . ToList ( ) ) . ToList ( ) ) ;
268+ /// <summary>Generates a reply keyboard markup with multiple rows of buttons</summary>
269+ /// <param name="textRows">Rows of buttons text </param>
270+ [ return : NotNullIfNotNull ( nameof ( textRows ) ) ]
271+ public static implicit operator ReplyKeyboardMarkup ? ( string [ ] [ ] ? textRows ) => textRows is null ? default
272+ : new ReplyKeyboardMarkup ( textRows . Select ( texts => texts . Select ( t => new KeyboardButton ( t ) ) . ToList ( ) ) . ToList ( ) ) ;
272273
273274 /// <summary>Generates a reply keyboard markup with one button</summary>
274- /// <param name="button">Keyboard button</param>
275+ /// <param name="button">Reply keyboard button</param>
275276 [ return : NotNullIfNotNull ( nameof ( button ) ) ]
276277 public static implicit operator ReplyKeyboardMarkup ? ( KeyboardButton ? button ) => button is null ? default : new ( button ) ;
277278
278279 /// <summary>Generates a reply keyboard markup with multiple buttons on one row</summary>
279- /// <param name="buttons">Keyboard buttons</param>
280+ /// <param name="buttons">Reply keyboard buttons</param>
280281 [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
281- public static implicit operator ReplyKeyboardMarkup ? ( KeyboardButton [ ] ? buttons ) => buttons is null ? default : new ( [ buttons ] ) ;
282+ public static implicit operator ReplyKeyboardMarkup ? ( KeyboardButton [ ] ? buttons ) => buttons is null ? default : new ( buttons ) ;
282283
283284 /// <summary>Generates a reply keyboard markup with multiple buttons on one row</summary>
284- /// <param name="buttons">Keyboard buttons</param>
285+ /// <param name="buttons">Reply keyboard buttons</param>
285286 [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
286287 public static implicit operator ReplyKeyboardMarkup ? ( List < KeyboardButton > ? buttons ) => buttons is null ? default : new ( buttons ) ;
287288
288- /// <summary>Generates a reply keyboard markup with multiple buttons</summary>
289- /// <param name="buttons">Keyboard buttons</param>
290- [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
291- public static implicit operator ReplyKeyboardMarkup ? ( List < List < KeyboardButton > > ? buttons ) => buttons is null ? default : new ( buttons ) ;
289+ /// <summary>Generates a reply keyboard markup with multiple rows of buttons</summary>
290+ /// <param name="buttonRows">Rows of reply keyboard buttons</param>
291+ [ return : NotNullIfNotNull ( nameof ( buttonRows ) ) ]
292+ public static implicit operator ReplyKeyboardMarkup ? ( List < List < KeyboardButton > > ? buttonRows ) => buttonRows is null ? default : new ( buttonRows ) ;
292293
293- /// <summary>Generates a reply keyboard markup with multiple buttons</summary>
294- /// <param name="buttons">Keyboard buttons</param>
295- [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
296- public static implicit operator ReplyKeyboardMarkup ? ( IEnumerable < KeyboardButton > [ ] ? buttons ) => buttons is null ? default : new ( buttons ) ;
294+ /// <summary>Generates a reply keyboard markup with multiple rows of buttons</summary>
295+ /// <param name="buttonRows">Rows of reply keyboard buttons</param>
296+ [ return : NotNullIfNotNull ( nameof ( buttonRows ) ) ]
297+ public static implicit operator ReplyKeyboardMarkup ? ( IEnumerable < KeyboardButton > [ ] ? buttonRows ) => buttonRows is null ? default : new ( buttonRows ) ;
297298
298299 /// <summary>Add a button to the last row</summary>
299300 /// <param name="button">The button or text to add</param>
@@ -330,27 +331,31 @@ public ReplyKeyboardMarkup AddNewRow(params KeyboardButton[] buttons)
330331
331332 public partial class InlineKeyboardMarkup
332333 {
333- /// <summary>Initializes a new instance of the <see cref="InlineKeyboardMarkup"/> class with only one keyboard button</summary>
334- /// <param name="inlineKeyboardButton">Keyboard button</param>
334+ /// <summary>Creates an <see cref="InlineKeyboardMarkup"/> with one button</summary>
335+ /// <param name="inlineKeyboardButton">Inline keyboard button</param>
335336 [ SetsRequiredMembers ]
336- public InlineKeyboardMarkup ( InlineKeyboardButton inlineKeyboardButton ) : this ( new List < List < InlineKeyboardButton > > { new ( ) { inlineKeyboardButton } } ) { }
337+ public InlineKeyboardMarkup ( InlineKeyboardButton inlineKeyboardButton )
338+ => InlineKeyboard = new List < List < InlineKeyboardButton > > { new ( ) { inlineKeyboardButton } } ;
337339
338- #pragma warning disable MA0016 // Prefer using collection abstraction instead of implementation
339- /// <summary>Initializes a new instance of the <see cref="InlineKeyboardMarkup"/> class with a one-row keyboard</summary>
340- /// <param name="inlineKeyboardRow">The inline keyboard row</param>
340+ /// <summary>Creates an <see cref="InlineKeyboardMarkup"/> with multiple buttons on one row</summary>
341+ /// <param name="inlineKeyboardRow">Rows of inline keyboard buttons</param>
341342 [ SetsRequiredMembers ]
342- public InlineKeyboardMarkup ( List < InlineKeyboardButton > inlineKeyboardRow ) : this ( new List < List < InlineKeyboardButton > > { inlineKeyboardRow } ) { }
343- #pragma warning restore MA0016 // Prefer using collection abstraction instead of implementation
343+ public InlineKeyboardMarkup ( params InlineKeyboardButton [ ] inlineKeyboardRow )
344+ => InlineKeyboard = new List < List < InlineKeyboardButton > > { inlineKeyboardRow . ToList ( ) } ;
344345
345- /// <summary>Initializes a new instance of the <see cref="InlineKeyboardMarkup"/> class with a one-row keyboard </summary>
346- /// <param name="inlineKeyboardRow">The inline keyboard row </param>
346+ /// <summary>Creates an <see cref="InlineKeyboardMarkup"/> with multiple buttons on one row </summary>
347+ /// <param name="inlineKeyboardRow">Rows of inline keyboard buttons </param>
347348 [ SetsRequiredMembers ]
348- public InlineKeyboardMarkup ( IEnumerable < InlineKeyboardButton > inlineKeyboardRow ) : this ( new List < List < InlineKeyboardButton > > { inlineKeyboardRow . ToList ( ) } ) { }
349+ public InlineKeyboardMarkup ( IEnumerable < InlineKeyboardButton > inlineKeyboardRow )
350+ => InlineKeyboard = new List < List < InlineKeyboardButton > > { inlineKeyboardRow . ToList ( ) } ;
349351
350- /// <summary>Initializes a new instance of the <see cref="InlineKeyboardMarkup"/> class with a one-row keyboard</summary>
351- /// <param name="inlineKeyboardRow">The inline keyboard row</param>
352+ #pragma warning disable MA0016 // Prefer using collection abstraction instead of implementation
353+ /// <summary>Creates an <see cref="InlineKeyboardMarkup"/> with multiple buttons on one row</summary>
354+ /// <param name="inlineKeyboardRow">Rows of inline keyboard buttons</param>
352355 [ SetsRequiredMembers ]
353- public InlineKeyboardMarkup ( params InlineKeyboardButton [ ] inlineKeyboardRow ) : this ( new List < List < InlineKeyboardButton > > { inlineKeyboardRow . ToList ( ) } ) { }
356+ public InlineKeyboardMarkup ( List < InlineKeyboardButton > inlineKeyboardRow )
357+ => InlineKeyboard = new List < List < InlineKeyboardButton > > { inlineKeyboardRow } ;
358+ #pragma warning restore MA0016 // Prefer using collection abstraction instead of implementation
354359
355360 /// <summary>Generate an empty inline keyboard markup</summary>
356361 /// <returns>Empty inline keyboard markup</returns>
@@ -362,29 +367,29 @@ public InlineKeyboardMarkup(params InlineKeyboardButton[] inlineKeyboardRow) : t
362367 public static implicit operator InlineKeyboardMarkup ? ( InlineKeyboardButton ? button ) => button is null ? default : new ( button ) ;
363368
364369 /// <summary>Generate an inline keyboard markup with one button</summary>
365- /// <param name="buttonText">Text of the button</param>
370+ /// <param name="buttonText">Text serving as the label of the button, as well as the URL to be opened or the callback data to be sent </param>
366371 [ return : NotNullIfNotNull ( nameof ( buttonText ) ) ]
367372 public static implicit operator InlineKeyboardMarkup ? ( string ? buttonText ) => buttonText is null ? default : new ( buttonText ) ;
368373
369- /// <summary>Generate an inline keyboard markup from multiple buttons on 1 row</summary>
370- /// <param name="buttons">Keyboard buttons</param>
374+ /// <summary>Generate an inline keyboard markup with multiple buttons on one row</summary>
375+ /// <param name="buttons">Inline keyboard buttons</param>
371376 [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
372377 public static implicit operator InlineKeyboardMarkup ? ( InlineKeyboardButton [ ] ? buttons ) => buttons is null ? default : new ( buttons ) ;
373378
374- /// <summary>Generate an inline keyboard markup from multiple buttons on 1 row</summary>
375- /// <param name="buttons">Keyboard buttons</param>
379+ /// <summary>Generate an inline keyboard markup with multiple buttons on one row</summary>
380+ /// <param name="buttons">Inline keyboard buttons</param>
376381 [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
377382 public static implicit operator InlineKeyboardMarkup ? ( List < InlineKeyboardButton > ? buttons ) => buttons is null ? default : new ( buttons ) ;
378383
379- /// <summary>Generate an inline keyboard markup from multiple buttons</summary>
380- /// <param name="buttons">Keyboard buttons</param>
381- [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
382- public static implicit operator InlineKeyboardMarkup ? ( List < List < InlineKeyboardButton > > ? buttons ) => buttons is null ? default : new ( buttons ) ;
384+ /// <summary>Generate an inline keyboard markup with multiple rows of buttons</summary>
385+ /// <param name="buttonRows">Rows of inline keyboard buttons</param>
386+ [ return : NotNullIfNotNull ( nameof ( buttonRows ) ) ]
387+ public static implicit operator InlineKeyboardMarkup ? ( List < List < InlineKeyboardButton > > ? buttonRows ) => buttonRows is null ? default : new ( buttonRows ) ;
383388
384- /// <summary>Generate an inline keyboard markup from multiple buttons</summary>
385- /// <param name="buttons">Keyboard buttons</param>
386- [ return : NotNullIfNotNull ( nameof ( buttons ) ) ]
387- public static implicit operator InlineKeyboardMarkup ? ( IEnumerable < InlineKeyboardButton > [ ] ? buttons ) => buttons is null ? default : new ( buttons ) ;
389+ /// <summary>Generate an inline keyboard markup with multiple rows of buttons</summary>
390+ /// <param name="buttonRows">Rows of inline keyboard buttons</param>
391+ [ return : NotNullIfNotNull ( nameof ( buttonRows ) ) ]
392+ public static implicit operator InlineKeyboardMarkup ? ( IEnumerable < InlineKeyboardButton > [ ] ? buttonRows ) => buttonRows is null ? default : new ( buttonRows ) ;
388393
389394 /// <summary>Add a button to the last row</summary>
390395 /// <param name="button">The button to add</param>
0 commit comments