From 321bd7c0ffee07714110043154216ff17e71e934 Mon Sep 17 00:00:00 2001 From: FlorianDahn Date: Fri, 27 Mar 2020 11:03:15 +0700 Subject: [PATCH] - adding GetButtonByValue to ButtonForm --- TelegramBotBase/Form/ButtonForm.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TelegramBotBase/Form/ButtonForm.cs b/TelegramBotBase/Form/ButtonForm.cs index 8f99423..8346c8c 100644 --- a/TelegramBotBase/Form/ButtonForm.cs +++ b/TelegramBotBase/Form/ButtonForm.cs @@ -124,6 +124,16 @@ namespace TelegramBotBase.Form return ikb; } + /// + /// Returns the first Button with the given value. + /// + /// + /// + public ButtonBase GetButtonByValue(String value) + { + return this.ToList().Where(a => a.Value == value).FirstOrDefault(); + } + public static implicit operator InlineKeyboardMarkup(ButtonForm form) { if (form == null)