Class ReplyMarkupMaker
A helper to create replyMarkups more easily See ReplyMarkupMaker for an easy way to create one of these
Inheritance
Inherited Members
Namespace: TelegramBotApi.Types.Markup
Assembly: TelegramBotApi.dll
Syntax
public class ReplyMarkupMaker
Constructors
| Improve this Doc View SourceReplyMarkupMaker(ReplyMarkupMaker.ReplyMarkupType)
Initializes a new ReplyMarkupMaker for the selected type
Declaration
public ReplyMarkupMaker(ReplyMarkupMaker.ReplyMarkupType type)
Parameters
Type | Name | Description |
---|---|---|
ReplyMarkupMaker.ReplyMarkupType | type | The type of keyboard to make |
Methods
| Improve this Doc View SourceAddCallbackButton(String, String, Int32)
Adds a button that sends a CallbackQuery when clicked to a keyboard. Only for InlineKeyboardMarkups. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddCallbackButton(string text, string callback, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button |
System.String | callback | Custom string to recognize the callback for your bot. Will be returned in Data when the button is clicked. |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddCallbackGameButton(String, String, Int32)
Adds a button that sends a callback query to your bot when clicked to a keyboard. You should answer the query with a game. Must be the first button in the first row. Only for InlineKeyboardMarkups. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddCallbackGameButton(string text, string callbackData, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button |
System.String | callbackData | Custom string to recognize this button by. Will be sent in Data. |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddInlineQueryButton(String, String, Boolean, Int32)
Adds a button that opens an inline query to your bot when clicked to a keyboard. Only for InlineKeyboardMarkups. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddInlineQueryButton(string text, string query, bool switchChat = true, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button |
System.String | query | The query to be typed in the chat. Can be empty. |
System.Boolean | switchChat | If true, requests the user to choose a chat to send the query to |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddPayButton(String, Int32)
Adds a button to pay an invoice to the keyboard. Does only work when sending an invoice. Must be the first button in the first row. Only for InlineKeyboardMarkups. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddPayButton(string text, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddRequestContactButton(String, Int32)
Adds a button that will send the users phone number as a contact when pressed. Private chats only. Only applicable to ReplyKeyboardMarkup. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddRequestContactButton(string text, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to be displayed on the button |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddRequestLocationButton(String, Int32)
Adds a button that will send the users location when pressed. Private chats only. Only applicable to ReplyKeyboardMarkup. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddRequestLocationButton(string text, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to be displayed on the button |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddRow()
Adds a new empty row of keys. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddRow()
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddTextButton(String, Int32)
Adds a pure text button to the Keyboard. In case of an inline keyboard, it will be a CallbackButton with "." as CallbackData Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddTextButton(string text, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button (and send on click, in case of a ReplyKeyboardMarkup) |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
AddUrlButton(String, String, Int32)
Adds a button that opens a URL when clicked to a keyboard. Only for InlineKeyboardMarkups. Returns the ReplyMarkupMaker to chain calls.
Declaration
public ReplyMarkupMaker AddUrlButton(string text, string url, int row = -1)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to display on the button |
System.String | url | The URL to open on clicking the button |
System.Int32 | row | The zero-based index of the row in which to add the button. If nothing is specified, uses last added row |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to chain calls |
Finish()
Returns the finished keyboard.
Declaration
public ReplyMarkupBase Finish()
Returns
Type | Description |
---|---|
ReplyMarkupBase | The finished keyboard |
SetOneTimeKeyboard(Boolean)
Requests clients to hide the keyboard as soon as it's been used. The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat – the user can press a special button in the input field to see the custom keyboard again. Defaults to false. Returns the ReplyMarkupMaker to be able to chain calls. Only applicable for ReplyKeyboardMarkup
Declaration
public ReplyMarkupMaker SetOneTimeKeyboard(bool oneTime)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | oneTime | True if the keyboard should be one-time |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to be able to chain calls. |
SetResizeKeyboard(Boolean)
Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. Returns the ReplyMarkupMaker to be able to chain calls. Only applicable for ReplyKeyboardMarkup
Declaration
public ReplyMarkupMaker SetResizeKeyboard(bool resize)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | resize | Whether to resize the Keyboard |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to be able to chain calls. |
SetSelective(Boolean)
Whether the reply markup should only be available for certain users. Targets are: users @mentioned in the message and the sender of the message replying to, if any Returns the ReplyMarkupMaker to be able to chain calls. Not available for InlineKeyboardMarkups
Declaration
public ReplyMarkupMaker SetSelective(bool selective)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | selective | True for a selective markup, false for a public one |
Returns
Type | Description |
---|---|
ReplyMarkupMaker | The ReplyMarkupMaker to be able to chain calls. |
Operators
| Improve this Doc View SourceImplicit(ReplyMarkupMaker to ReplyMarkupBase)
Implicitly creates the keyboard from a ReplyKeyboardMaker
Declaration
public static implicit operator ReplyMarkupBase(ReplyMarkupMaker maker)
Parameters
Type | Name | Description |
---|---|---|
ReplyMarkupMaker | maker | The maker |
Returns
Type | Description |
---|---|
ReplyMarkupBase |