bugfixes; touching a 5 month old projects code was n ot a good idea
This commit is contained in:
@@ -1,17 +1,18 @@
|
||||
import json
|
||||
import os
|
||||
from config import roles_message_id
|
||||
|
||||
DATA_FILE = 'data/role_message_id.json'
|
||||
|
||||
def save_message_id(message_id):
|
||||
os.makedirs('data', exist_ok=True)
|
||||
with open(roles_message_id, 'w') as f:
|
||||
with open(DATA_FILE, 'w') as f:
|
||||
json.dump({'message_id': message_id}, f)
|
||||
|
||||
def load_message_id():
|
||||
try:
|
||||
with open(roles_message_id, 'r') as f:
|
||||
with open(DATA_FILE, 'r') as f:
|
||||
data = json.load(f)
|
||||
return data.get('message_id')
|
||||
return data.get('message_id')
|
||||
except FileNotFoundError:
|
||||
return None
|
||||
except json.JSONDecodeError:
|
||||
|
||||
Reference in New Issue
Block a user