Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @user_client.on(events.NewMessage(chats=None))
- @user_client.on(events.Album())
- async def copy_to_channel(event):
- try:
- chat_id = int(str(event.chat_id)[4:])
- chat = await user_client.get_entity(chat_id)
- if not chat.broadcast or chat_id not in await get_unique_donor_ids():
- return
- to_channels = await get_channels_with_autoposting(chat_id)
- gallery = getattr(event, 'messages', None)
- if not gallery and event.grouped_id:
- return
- for to_channel in to_channels:
- if gallery:
- await user_client.send_file(to_channel, gallery)
- else:
- await user_client.send_message(to_channel, event.message)
- except:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement