diff options
author | Kyomotoi <[email protected]> | 2020-11-07 13:54:57 +0800 |
---|---|---|
committer | Kyomotoi <[email protected]> | 2020-11-07 13:54:57 +0800 |
commit | 7cae371b51a14c626ce184987eea2392e15430b9 (patch) | |
tree | a35aa21a64dad59a8dc91270d78f781dbed8953d /utils/utils_banList | |
parent | 11e4632aaf2be56c776dbc4e9f0ad5065bb60b5f (diff) | |
download | ATRI-7cae371b51a14c626ce184987eea2392e15430b9.tar.gz ATRI-7cae371b51a14c626ce184987eea2392e15430b9.tar.bz2 ATRI-7cae371b51a14c626ce184987eea2392e15430b9.zip |
[Update]
Diffstat (limited to 'utils/utils_banList')
-rw-r--r-- | utils/utils_banList/__init__.py | 80 | ||||
-rw-r--r-- | utils/utils_banList/banList_group.json | 1 | ||||
-rw-r--r-- | utils/utils_banList/banList_user.json | 1 |
3 files changed, 0 insertions, 82 deletions
diff --git a/utils/utils_banList/__init__.py b/utils/utils_banList/__init__.py deleted file mode 100644 index e7ccbec..0000000 --- a/utils/utils_banList/__init__.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 -# -*- 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: Optional[str] = None, group: Optional[str] = None) -> bool: - """ - :说明: - - 判断某一 用户/群 是否处于封禁名单中。 - - :参数: - - * ``user: Optional[str] = None``: 用户QQ号 - * ``group: Optional[str] = None``: 用户所在群号 - * !!!二者必须传入一个,否则一律返回 False !!! - - :返回: - - 是:False | 否:True - - :用法: - - .. code-block:: python - - banList(user=123456789, group=123456789) - - """ - file_user = Path('.') / 'utils' / 'utils_banList' / 'banList_user.json' - file_group = Path('.') / 'utils' / 'utils_banList' / 'banList_group.json' - - try: - with open(file_user, 'r') as f: - data_user = json.load(f) - except: - data_user = {} - - try: - with open(file_group, 'r') as f: - data_group = json.load(f) - except: - 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 True - else: - return False - - else: - return False
\ No newline at end of file diff --git a/utils/utils_banList/banList_group.json b/utils/utils_banList/banList_group.json deleted file mode 100644 index 9e26dfe..0000000 --- a/utils/utils_banList/banList_group.json +++ /dev/null @@ -1 +0,0 @@ -{}
\ No newline at end of file diff --git a/utils/utils_banList/banList_user.json b/utils/utils_banList/banList_user.json deleted file mode 100644 index 9e26dfe..0000000 --- a/utils/utils_banList/banList_user.json +++ /dev/null @@ -1 +0,0 @@ -{}
\ No newline at end of file |