Похожие чаты

Hi. this is my code and i want to save

the session file as (.session) but its not saving and i got no error. what should i do about this?

@client.on(events.NewMessage(chats=(-1001963929324)))
async def handle_new_message(event):

if event.message:

# Respond to the message with the predefined message
await client.send_message('sepi_rosho',"Test Acc1")
await client.forward_messages('pashmak_abdo', event.message)



# Start the client
client.start()
client.session.save()
client.run_until_disconnected()

16 ответов

21 просмотр

you don't need to save it manually, disconnect properly, the .session is genrate as client.session.filename

Sepi- Автор вопроса
⎞ .·. ⎝ ⎝
you don't need to save it manually, disconnect pro...

thats the point. it doesnt generate but next time i run my code, it doesnt want me to login again. im wondering where that session files whould save

Sepi
thats the point. it doesnt generate but next time ...

it has to be in client.session.filename. as long as you don't face runtime error that database is not accessible, you're just checking wrong

Sepi- Автор вопроса
Sepi
it should save in the same directory right?

it should, unless you pass directory to TelegramClient

Sepi- Автор вопроса

show your TelegramClient part of code

they're literally different directories doe or am i seeing it wrong, just print the import os print(os.getcwd()) in your code and navigate there.

Sepi- Автор вопроса
⎞ .·. ⎝ ⎝
they're literally different directories doe or am ...

im running the code in my vps i got this screen shot from my pc

Sepi
im running the code in my vps i got this screen sh...

your system is to blame them.. as long as you don't pass :memory: as session name, it has no reason to not create it. see if the session exists while the script is running, and do the prints and stuff

Sepi- Автор вопроса
⎞ .·. ⎝ ⎝
your system is to blame them.. as long as you don'...

code works fine but there is no session file in that directory even when the code is running

Sepi
code works fine but there is no session file in th...

well that's weird, telethon writes to the database, system deleting it with no error poping while running is unrealistic session creation happens once you make an instance. you don't need to start or save the code you show can't have such issues afaik, confirm it better, you may be running it from a different workdir, if it started to happen recently

Sepi- Автор вопроса

i found the problem and its kinda crazy when you run the code through vs code, it saves the session files in another directory but when you manully enter your folder and run it using cmd and 'py' command, the session file will create in the same directory

Sepi
i found the problem and its kinda crazy when you r...

yeah, this is expected. that's why i said print your cwd. you can use os.chdir to change cwd where your .py file

Sepi- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта