-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restricted filter not working with groups or topics #123
Comments
Hi, @bratcorpse |
sorry for the late response, it's forwarding text but not attachments INFO 2024-08-27 06:08:36,843 [mirroring.py:71]:telemirror: [New message]: https://t.me/c/2182848314/7 `from typing import Tuple, Type from ..hints import EventMessage, EventLike class RestrictSavingContentBypassFilter(MessageFilter):
this is the restrictedfilter.py which i'm using |
Check that filter was added to |
Thank you, photos are working not but it's not sending videos |
Yep, you can handle other types: ...
elif isinstance(message.media, types.MessageMediaDocument):
client: TelegramClient = message.client
downloaded_media: bytes = await client.download_media(
message=message, file=bytes
)
cloned_media_file: types.TypeInputFile = await client.upload_file(
downloaded_media
)
cloned_media = types.InputMediaUploadedDocument(
file=cloned_media_file,
mime_type=message.media.document.mime_type,
attributes=message.media.document.attributes,
spoiler=message.media.spoiler,
ttl_seconds=message.media.ttl_seconds,
)
message.media = cloned_media
else:
... I think it's also a good idea to check the maximum size for the file, RAM might not be enough for big files: if message.file and message.file.size > self._max_file_size_bytes:
# File too big
return False, message Or even re-upload from the filesystem. |
Thank you for the help, really appreciate it <3!! |
The restricted filter is working fine with channels but it isn't working with groups or topics
The text was updated successfully, but these errors were encountered: