justdmitry / NetTelegramBotApi

C# client library for building Telegram bot
MIT License
74 stars 28 forks source link

Option to send keyboard #23

Closed iSunilSV closed 9 years ago

iSunilSV commented 9 years ago

Added another constructor in SendMessage, which enables the user to send keyboard as reply

justdmitry commented 9 years ago

SendMessage have 4 additional properties, not mentioned in constructor, because all of them are optional. Adding all optional properties in all request types will create a mess. Why you think ReplyMarkup is more important than others?

BTW, you can assign properties when constructing object in this way:

var req = new SendMessage(<someid>, <sometext>) { ReplyMarkup = <customKeyboard> };
iSunilSV commented 9 years ago

ReplyMarkUp actually becomes a part of the message when someone sends a message. I don't see it as a property. Hence, suggested the change.

justdmitry commented 9 years ago

All four properties are equally important from time to time (ParseMode, DisableWebPagePreview, ReplyToMessageId, ReplyMarkup), but they are not required to be always presented. So, they are only optional properties, while Text property is always required (you can't send message without text), thus text is also a parameter in constructor.

So, unless you have strong reason for not using property, I prefer do not pollute constructors with optional parameters.

iSunilSV commented 9 years ago

I don't have any other reason.