Update
- adding more Constants to Telegram file - Buttongrid: fixing check for rows and columns - Buttongrid: replacingvalues with constants from Telegram file
This commit is contained in:
parent
321bd7c0ff
commit
164194ac66
@ -13,5 +13,13 @@ namespace TelegramBotBase.Constants
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const int MaxMessageLength = 4096;
|
public const int MaxMessageLength = 4096;
|
||||||
|
|
||||||
|
public const int MaxInlineKeyBoardRows = 13;
|
||||||
|
|
||||||
|
public const int MaxInlineKeyBoardCols = 8;
|
||||||
|
|
||||||
|
public const int MaxReplyKeyboardRows = 25;
|
||||||
|
|
||||||
|
public const int MaxReplyKeyboardCols = 12;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -167,27 +167,27 @@ namespace TelegramBotBase.Controls
|
|||||||
{
|
{
|
||||||
case eKeyboardType.InlineKeyBoard:
|
case eKeyboardType.InlineKeyBoard:
|
||||||
|
|
||||||
if (ButtonsForm.Rows > 13)
|
if (ButtonsForm.Rows > Constants.Telegram.MaxInlineKeyBoardRows)
|
||||||
{
|
{
|
||||||
throw new MaximumRowsReachedException() { Value = ButtonsForm.Rows, Maximum = 13 };
|
throw new MaximumRowsReachedException() { Value = ButtonsForm.Rows, Maximum = Constants.Telegram.MaxInlineKeyBoardRows };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ButtonsForm.Rows > 8)
|
if (ButtonsForm.Cols > Constants.Telegram.MaxInlineKeyBoardCols)
|
||||||
{
|
{
|
||||||
throw new MaximumColsException() { Value = ButtonsForm.Rows, Maximum = 8 };
|
throw new MaximumColsException() { Value = ButtonsForm.Rows, Maximum = Constants.Telegram.MaxInlineKeyBoardCols };
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case eKeyboardType.ReplyKeyboard:
|
case eKeyboardType.ReplyKeyboard:
|
||||||
|
|
||||||
if (ButtonsForm.Rows > 25)
|
if (ButtonsForm.Rows > Constants.Telegram.MaxReplyKeyboardRows)
|
||||||
{
|
{
|
||||||
throw new MaximumRowsReachedException() { Value = ButtonsForm.Rows, Maximum = 25 };
|
throw new MaximumRowsReachedException() { Value = ButtonsForm.Rows, Maximum = Constants.Telegram.MaxReplyKeyboardRows };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ButtonsForm.Rows > 12)
|
if (ButtonsForm.Cols > Constants.Telegram.MaxReplyKeyboardCols)
|
||||||
{
|
{
|
||||||
throw new MaximumColsException() { Value = ButtonsForm.Rows, Maximum = 12 };
|
throw new MaximumColsException() { Value = ButtonsForm.Rows, Maximum = Constants.Telegram.MaxReplyKeyboardCols };
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user