client = TelegramClient('telegramfw', api_id, api_hash)
@client.on(events.NewMessage)
@client.on(events.MessageEdited)
async def handler(event):
chat = await event.get_chat()
chat_id = event.chat_id
print(chat_id)
if chat_id == -1001629488043:
if event.photo:
await client.send_file(-1001567215170, event.photo, caption=event.raw_text)
elif event.video:
await client.send_file(-1001567215170, event.video, caption=event.raw_text)
else:
msg = event.raw_text
print(msg)
msg_id_source = event.message.id
await client.send_message(-1001567215170, msg)
client.start()
client.run_until_disconnected()
我看了一下这个装饰器就是调用 client.add_event_handler,不用装饰器的话可以直接添加,用的话有什么办法吗