diff options
author | Kyomotoi <[email protected]> | 2020-10-18 15:22:16 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-10-18 15:22:16 +0800 |
commit | e96c42ef2006e052dc334c1cc1771e546f357fae (patch) | |
tree | f1f813573396f0b7ecd005bed8b8bfb54f355a72 /utils/utils_banList | |
parent | 9b1384577c16486f8ea21632a0cee50e05fd43ad (diff) | |
download | ATRI-e96c42ef2006e052dc334c1cc1771e546f357fae.tar.gz ATRI-e96c42ef2006e052dc334c1cc1771e546f357fae.tar.bz2 ATRI-e96c42ef2006e052dc334c1cc1771e546f357fae.zip |
[Update]
Diffstat (limited to 'utils/utils_banList')
-rw-r--r-- | utils/utils_banList/__init__.py | 45 |
1 files changed, 35 insertions, 10 deletions
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 : [email protected] +@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 |