-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpersistence.py
32 lines (26 loc) · 1.03 KB
/
persistence.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from telegram.ext import PicklePersistence
from settings import pickle_logs, CHATID
def init_persistance():
# if os.path.exists(pickle_logs):
# os.remove(pickle_logs)
# else:
# print("Good!!! - The file does not exist!")
# fei_persist = PicklePersistence(
# filename=pickle_logs,
# store_user_data=True, store_chat_data=True,
# single_file=True)
# fei_persist.flush()
# userData = fei_persist.get_user_data()
# chatData = fei_persist.get_chat_data()
# userConv = fei_persist.get_conversations(CHATID)
# uDataFile = open(r"log/userData.txt", "w")
# cDataFile = open(r"log/chatData.txt", "w")
# cnvDataFile = open(r"log/convData.txt", "w")
# uDataFile.write(str(userData))
# uDataFile.close()
# cDataFile.write(str(chatData))
# cDataFile.close()
# cnvDataFile.write(str(userConv))
# cnvDataFile.close()
return PicklePersistence(filename=pickle_logs, store_user_data=True, store_chat_data=True, store_bot_data=True, single_file=False)