fixed userFile FileExistsError
This commit is contained in:
BIN
.gitignore
vendored
BIN
.gitignore
vendored
Binary file not shown.
@@ -16,6 +16,7 @@ import asyncio
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
userFile = Path('/config/users.json')
|
userFile = Path('/config/users.json')
|
||||||
|
userFile.touch(exist_ok=True)
|
||||||
|
|
||||||
bot = interactions.Client(intents=interactions.Intents.DEFAULT,default_scope=2147491904)
|
bot = interactions.Client(intents=interactions.Intents.DEFAULT,default_scope=2147491904)
|
||||||
|
|
||||||
@@ -24,6 +25,7 @@ try:
|
|||||||
with open(userFile, 'x') as f:
|
with open(userFile, 'x') as f:
|
||||||
print(f'users.json not found; saving to {userFile}')
|
print(f'users.json not found; saving to {userFile}')
|
||||||
except FileExistsError:
|
except FileExistsError:
|
||||||
|
with open(userFile, 'r') as f:
|
||||||
authorized_users = json.load(f).get('authorized_users')
|
authorized_users = json.load(f).get('authorized_users')
|
||||||
print(f'authorized_users:{authorized_users}')
|
print(f'authorized_users:{authorized_users}')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user