Class KeyboardButton
This object represents one button of the reply keyboard. For simple text buttons String can be used instead of this object to specify text of the button. Optional fields are mutually exclusive.
Inheritance
Inherited Members
Namespace: TelegramBotApi.Types.Markup
Assembly: TelegramBotApi.dll
Syntax
[JsonObject(MemberSerialization = MemberSerialization.OptIn, ItemNullValueHandling = NullValueHandling.Ignore)]
public class KeyboardButton
Constructors
| Improve this Doc View SourceKeyboardButton()
Initializes a new, empty instance of the KeyboardButton class. Has to be filled with data.
Declaration
public KeyboardButton()
KeyboardButton(String)
Initializes a new instance of the KeyboardButton class
Declaration
public KeyboardButton(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text on the button (will be sent when it is clicked) |
Properties
| Improve this Doc View SourceRequestContact
Optional. If True, the user's phone number will be sent as a contact when the button is pressed. Available in private chats only
Declaration
[JsonProperty(PropertyName = "request_contact")]
public bool RequestContact { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
RequestLocation
Optional. If True, the user's current location will be sent when the button is pressed. Available in private chats only
Declaration
[JsonProperty(PropertyName = "request_location")]
public bool RequestLocation { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Text
Text of the button. If none of the optional fields are used, it will be sent as a message when the button is pressed
Declaration
[JsonProperty(PropertyName = "text", Required = Required.Always)]
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |