From da0c65bc7d6afacac59dc42c1b9e56d4080ee607 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 27 Oct 2020 14:53:44 +0100 Subject: [PATCH] Replace session files with string session --- .gitignore | 1 - src/bot.py | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index e8fbc22..c9fd099 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ src/constants.py -*.session diff --git a/src/bot.py b/src/bot.py index 43a04c5..10ad65b 100644 --- a/src/bot.py +++ b/src/bot.py @@ -1,7 +1,10 @@ from telethon import TelegramClient, events -from constants import API_ID, API_HASH, BOT_TOKEN +from telethon.sessions import StringSession +from constants import API_ID, API_HASH, BOT_TOKEN, SESSION -bot = TelegramClient("bot", API_ID, API_HASH).start(bot_token=BOT_TOKEN) +bot = TelegramClient(StringSession(SESSION), API_ID, API_HASH).start( + bot_token=BOT_TOKEN +) @bot.on(events.NewMessage(pattern="/start"))