Похожие чаты

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

11 просмотров

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

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

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- Автор вопроса

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

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

А как старый хаскел с новым стыковать ? потому как тут работает https://play.haskell.org/saved/C3xpMzcd, а вот тут https://stepik.org/lesson/7602/step/9?unit=1473 нет ошибка C...
Fedor
131
что насчет пагинга? на осдеве непонятно(
Vi Chapmann 🪙
26
Guys what is ur real (no jokes) expectation of link price during this cycle?
Hobbyist
28
hey everyone I'm not able to input come characters in my flatpak apps, they get ignored by the application. all other non-flatpak apps are fine with these characters. I search...
elo
20
>>> Failed to install app-alternatives/awk-4, Log file: >>> '/var/tmp/portage/app-alternatives/awk-4/temp/build.log' * Messages for package app-alternatives/awk-4: * Pa...
[cocoa] wizzy hell
1
Вопрос я правильно понимаю что в коде newtype ArrowMap k v = ArrowMap { getArrowMap :: k -> Maybe v } getArrowMap есть функция типа k -> Maybe v, если да, то не понимаю задач...
Fedor
64
Hey everyone! How's your weekend going so far?
Noah Noure
17
Hey, it seems like a solid project for the gaming industry. What are your initial thoughts?
Josh
26
Ребят, что лучше для реверса: гидра или ида?
En Vind Av Sorg
26
Делаю велосипед логгер. К сообщению хочу прикрутить некоторую информацию, типа, кем отправлено, какой уровень, и всякое такое. И тут подумалось мне, почему бы не хранить весь...
Serjone
24
Карта сайта