Enka_Genshin_bot/defs/bind.py

26 lines
464 B
Python
Raw Permalink Normal View History

2022-06-04 04:32:48 +00:00
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