Closed palashjhabak closed 3 years ago
Hey, thanks for your response. So in general sure we can check for null and other stuff at any method. But maybe it is more part of the developer using the framework itself to manage to sending "null" messages. Cause it will throw an exception any way.
And more important can lead to performance issues as well.
Regards Floh
Yes completely agree with you but in this particular case sending null to the user could very well be a valid scenario (unless telegram bot API itself does not allow it) which will fail with current code and only way to send would be to send "null" instead of null.
Please be aware, that this framework uses another nuget package as stated in the Readme.md. So they have already some checks inside. And I want to keep this "module" as light as possible.
yes I agree that it should be kept as light as possible, but I was highlighting that if I genuinely wanted to send null using Device.Send method, it will fail at text.length line of the code and will not even pass it to the Telegram.Net client. I hope I was clear.
Ah ok, now I know where you want to go. Sure we can add something there easily, I will take a look later on the development branch.
https://github.com/MajMcCloud/TelegramBotFramework/blob/bd908db867e4be0835715f274cf61309b52a2d27/TelegramBotBase/Sessions/DeviceSession.cs#L263
Although one could handle it by catching an exception but I think better way is to null check the text.