I create a userbot, who gets some memes from several channels and resend it to my chat with friends.
Bot listens channel and successfull send messages by this code:
await bot.send_message(chat_id, event.message)
But because of some photos may be not safe for work, i would like to hide media by spoiler.
I see that question Telethon send image with spoiler , where Lonami's code suggest downloading and then uploading file, but my server, where bot hosted has limit internet connection, so that solution didn't work.
Is there any chance to make file object, that can be send as uploaded file in this construction?
await client.send_file(chat, types.InputMediaUploadedPhoto( uploaded, spoiler=True, ))
Tried to use types.MessageMediaDocument and other, but it raises errors.
Since telethon is in a hiatus, proper fields aren't implemented yet, however the api layer is updated and utils are fully exposed and togglable to easily patch the media object directly to the event if event contained a media with spoilers, no need for a reupload, as the other SO question, since that's a different one.
from telethon.utils import get_input_media
... # the rest of your NewMeasage code
if getattr(event.media, 'spoiler', None):
event.media = get_input_media(event.media)
event.media.spoiler=True
await bot.send_message(chat_id, event.message)