vk_chat_bot/config.py

39 lines
614 B
Python

import json
# db = {
# chats: {
# CHAT_ID: {
# users: {
# USER_ID: {
# messages_today: 10
# messages_in_month: 1045
# last_message: 1755627442
# }
# }
# }
# },
# api_token: "xxxxxxxx"
# }
DB = {}
def db_load():
global DB
try:
file = open('db.json', 'r')
DB = json.load(file)
file.close()
except IOError:
DB = {'chats': {}, 'api_token': ''}
def db_save():
global DB
with open('db.json', 'w') as file:
json.dump(DB, file, indent=4)
def db_print():
global DB
print(DB)