From e96c42ef2006e052dc334c1cc1771e546f357fae Mon Sep 17 00:00:00 2001 From: Kyomotoi <1172294279@qq.com> Date: Sun, 18 Oct 2020 15:22:16 +0800 Subject: [Update] --- utils/utils_banList/__init__.py | 45 ++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'utils/utils_banList') diff --git a/utils/utils_banList/__init__.py b/utils/utils_banList/__init__.py index 66142cc..e7ccbec 100644 --- a/utils/utils_banList/__init__.py +++ b/utils/utils_banList/__init__.py @@ -1,11 +1,20 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- +# -*- encoding: utf-8 -*- +''' +@File : __init__.py +@Time : 2020/10/11 14:42:59 +@Author : Kyomotoi +@Contact : kyomotoiowo@gmail.com +@Github : https://github.com/Kyomotoi +@License : Copyright © 2018-2020 Kyomotoi, All Rights Reserved. +''' +__author__ = 'kyomotoi' import json from pathlib import Path from typing import Optional -def banList(user: str, group: Optional[str] = None) -> bool: +def banList(user: Optional[str] = None, group: Optional[str] = None) -> bool: """ :说明: @@ -13,8 +22,9 @@ def banList(user: str, group: Optional[str] = None) -> bool: :参数: - * ``user: str``: 用户QQ号 - * ``group: Optional[str] = None``: 用户所在群号,若不传入则只检测用户 + * ``user: Optional[str] = None``: 用户QQ号 + * ``group: Optional[str] = None``: 用户所在群号 + * !!!二者必须传入一个,否则一律返回 False !!! :返回: @@ -42,14 +52,29 @@ def banList(user: str, group: Optional[str] = None) -> bool: except: data_group = {} - if user not in data_user: - if group: - if group not in data_group: + if user: + if user not in data_user: + if group: + if group not in data_group: + return True + else: + return False + else: return True + else: + return False + + elif group: + if group not in data_group: + if user: + if user not in data_user: + return True + else: + return False else: - return False + return True else: - return True + return False + else: - print(3) return False \ No newline at end of file -- cgit v1.2.3