@client.on(events.NewMessage(chats=[ids]))
async def my_event_handler(event):
me = await client.get_me()
username = me.username
try:
if event.from_id is not None:
from_ = await event.client.get_entity(event.from_id)
except ValueError:
pass
if event.file:
path = await client.download_media(event.media, "./media/")
if event.file.name == None:
if from_ is not None:
await client.send_message("me", f"{from_.username}: (File name is None)")
await client.send_message("me", f"auto-downloader: (File name is None) saved to ./media/")
else:
await client.send_message("me", f"None: {event.text}")
print(f"file | | (File name is None) downloaded")
else:
if from_ is not None:
await client.send_message("me", f"{from_.username}: {event.file.name}")
await client.send_message("me", f"auto-downloader: {event.file.name} saved to ./media/")
else:
await client.send_message("me", f"None: {event.text}")
print(f"file | | {event.file.name} downloaded")
else:
await client.send_message("me", f"{from_.username}: {event.text}")
print(f"msg | {from_.username} | {event.text}")
@client.on(events.NewMessage(chats=[ids]))
async def my_event_handler(event):
me = await client.get_me()
username = me.username
try:
from_ = await event.client.get_entity(event.from_id)
if event.from_id is not None:
from_ = await event.client.get_entity(event.from_id)
except ValueError:
pass
if event.file:
path = await client.download_media(event.media, "./media/")
if event.file.name == None:
if from_ is not None:
await client.send_message("me", f"{from_.username}: (File name is None)")
await client.send_message("me", f"auto-downloader: (File name is None) saved to ./media/")
else:
await client.send_message("me", f"None: {event.text}")
print(f"file | | (File name is None) downloaded")
else:
if from_ is not None:
await client.send_message("me", f"{from_.username}: {event.file.name}")
await client.send_message("me", f"auto-downloader: {event.file.name} saved to ./media/")
else:
await client.send_message("me", f"None: {event.text}")
print(f"file | | {event.file.name} downloaded")
else:
await client.send_message("me", f"{from_.username}: {event.text}")
print(f"msg | {from_.username} | {event.text}")
'import/no-restricted-paths': [
'error',
{
'zones': [
{
'target': './src/components',
'from': './src/my/components',
},
],
},
],
import MyComponent from '../my/components/MyComponent';