Please remove implicit operator InputOnlineFile(stream)
It confuses people more than help them.
Nobody ever wants to send a nameless file without an extension defining the type.
Additionally, you could make the fileName parameter mandatory (no default null value) on:
public InputOnlineFile(Stream content, string? fileName = null)
I do agree that all SendXXXAsync() methods would benefit from this approach.
But there are few cases, where file name should not be mandatory:
- a
certificateparameter insetWebhook - a
photoparameter insetChatPhoto -
*sticker*parameters increateNewStickerSet,sendSticker,uploadStickerFile,addStickerToSet,setStickerSetThumb - all
thumbparameters...
Should we enforce users to specify FileName in some methods with new NamedStreamFileSomething type?
I did some changes in InputFile type hierarchy to align it with the Bot API:
https://github.com/TelegramBots/Telegram.Bot/tree/karb0f0s/input_file
certificateparameter insetWebhookthis one is InputFileStream, not InputOnlineFile
for the other, if type is implicit regardless of filename/extension, user can still pass an explicit null as filename.
in any case, if you don't accept my second suggestion (InputOnlineFile mandatory 2nd argument), the removal of implicit operator will force the dev to get interested in the InputOnlineFile constructors and find out the filename parameter if they need it.
I don't really like the idea of passing null around.
Giving this whole issue some though it seems that the only method that actually requires file extension is SendDocument. For all other cases/media types extension is not important or relevant.
I'd love to see some prototype/suggestion on how this case should be handled.
then maybe have an overload of SendDocument take Stream and filename arguments instead of InputOnlineFile
Resolved by #1147.