Add feature
This commit is contained in:
parent
c4579c6d09
commit
768f8d5acc
@ -66,6 +66,12 @@ def get_dc_text(name: str, dc_id: int) -> str:
|
|||||||
return "❗️ 无法获取该用户/群组的数据中心 ..."
|
return "❗️ 无法获取该用户/群组的数据中心 ..."
|
||||||
|
|
||||||
|
|
||||||
|
def get_sender_name(msg: Message) -> str:
|
||||||
|
if msg.from_user:
|
||||||
|
return get_fullname(msg.from_user)
|
||||||
|
return msg.sender_chat.title
|
||||||
|
|
||||||
|
|
||||||
def get_fullname(user: User) -> str:
|
def get_fullname(user: User) -> str:
|
||||||
if user:
|
if user:
|
||||||
if user.last_name:
|
if user.last_name:
|
||||||
|
@ -77,13 +77,12 @@ def get_alias_of_cmds() -> Dict[str, str]:
|
|||||||
return dict(zip(cmd_yml.keys(), (v.get('cmd') for v in cmd_yml.values())))
|
return dict(zip(cmd_yml.keys(), (v.get('cmd') for v in cmd_yml.values())))
|
||||||
|
|
||||||
|
|
||||||
async def pull_and_update_command_yml() -> None:
|
async def pull_and_update_command_yml(is_update: bool = True) -> None:
|
||||||
# 读取远程command.yml
|
# 读取远程command.yml
|
||||||
async with session.get(
|
async with session.get(CMD_YML_REMOTE, timeout=9.9) as resp:
|
||||||
CMD_YML_REMOTE, timeout=9.9,
|
|
||||||
) as resp:
|
|
||||||
if resp.status == 200:
|
if resp.status == 200:
|
||||||
data = yaml.full_load(await resp.text())
|
data = yaml.full_load(await resp.text())
|
||||||
|
if is_update:
|
||||||
with open(COMMAND_YML, "rb") as f:
|
with open(COMMAND_YML, "rb") as f:
|
||||||
cmd_yml: Dict[str, Dict[str, str]] = yaml.full_load(f)
|
cmd_yml: Dict[str, Dict[str, str]] = yaml.full_load(f)
|
||||||
data.update(cmd_yml)
|
data.update(cmd_yml)
|
||||||
|
Loading…
Reference in New Issue
Block a user