26 lines
464 B
Python
26 lines
464 B
Python
|
from ci import sqlite
|
||
|
|
||
|
|
||
|
def get_bind_list() -> dict:
|
||
|
return sqlite.get("bind", {})
|
||
|
|
||
|
|
||
|
def get_bind_uid(uid: int) -> str:
|
||
|
return get_bind_list().get(uid, None)
|
||
|
|
||
|
|
||
|
def set_bind(uid: int, player: str):
|
||
|
data = get_bind_list()
|
||
|
data[uid] = player
|
||
|
sqlite["bind"] = data
|
||
|
|
||
|
|
||
|
def remove_bind(uid: int):
|
||
|
data = get_bind_list()
|
||
|
data.pop(uid, None)
|
||
|
sqlite["bind"] = data
|
||
|
|
||
|
|
||
|
def check_bind(uid: int) -> bool:
|
||
|
return get_bind_uid(uid) is not None
|