TelegramBots / Telegram.Bot

.NET Client for Telegram Bot API
https://telegrambots.github.io/book
MIT License
3.17k stars 686 forks source link

Add SetPassportDataErrors method #923

Closed Muaath5 closed 4 years ago

Muaath5 commented 4 years ago

I would like to request/propose a feature

I suggest add SetPassportDataErrors method to TelegramBotClient

Why? Because It's Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change).


Method Parameters: Parameter Type Required Description
user_id Integer Yes User identifier
errors Array of PassportElementError Yes A JSON-serialized array describing the errors

Returns True on success.


Telegram API documentation for this method

MihaZupan commented 4 years ago

Passport-related logic is implemented in a separate package: https://github.com/TelegramBots/Telegram.Bot.Extensions.Passport

This method is included there.

Muaath5 commented 4 years ago

But why this method is an extension method? I suggest to add it to TelegramBotClient with no any extensions.

MihaZupan commented 4 years ago

You can't extend a class that way from an external package - an extension method is the only way.

We are also removing almost all methods from TelegramBotClient and using extension methods instead in a future release. That is because we want to keep the ITelegramBotClient interface minimal and avoid breaking it with every version.

From a caller's perspective, TelegramBotClient use stays the same