Похожие чаты

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 ответов

50 просмотров

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

Береговой-Мим Автор вопроса
Растровый Слон
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

Береговой Мим
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

Береговой-Мим Автор вопроса

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.

Береговой-Мим Автор вопроса
Растровый Слон
they're literally different directories doe or am ...

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

Береговой Мим
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

Береговой-Мим Автор вопроса
Растровый Слон
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

Береговой Мим
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

Береговой-Мим Автор вопроса

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

Береговой Мим
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

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Мелодичный Сырник
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Фетровый Лингвист
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Настойчивый Кварк
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...
Льдистая Лужица
2
30500 за редактор? )
Замшевый Алхимик
47
а через ESC-код ?
Виноградная Притча
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...
Звенящий Циферблат
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Туманный Ларец
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Длинный Минерал
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Тягучая Ракушка
11
Карта сайта