Replace session files with string session

This commit is contained in:
coolneng 2020-10-27 14:53:44 +01:00
parent 2c63287f9d
commit da0c65bc7d
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 5 additions and 3 deletions

1
.gitignore vendored
View File

@ -1,2 +1 @@
src/constants.py src/constants.py
*.session

View File

@ -1,7 +1,10 @@
from telethon import TelegramClient, events 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")) @bot.on(events.NewMessage(pattern="/start"))