summaryrefslogtreecommitdiff
path: root/ATRI/utils/utils_textcheck/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/utils/utils_textcheck/__init__.py')
-rw-r--r--ATRI/utils/utils_textcheck/__init__.py60
1 files changed, 0 insertions, 60 deletions
diff --git a/ATRI/utils/utils_textcheck/__init__.py b/ATRI/utils/utils_textcheck/__init__.py
deleted file mode 100644
index be1553e..0000000
--- a/ATRI/utils/utils_textcheck/__init__.py
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/env python3
-# -*- encoding: utf-8 -*-
-'''
-@File : data_source.py
-@Time : 2020/11/21 19:54:11
-@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
-
-PUBLIC_OPINION_PATH = Path('.') / 'ATRI' / 'utils' / 'utils_textcheck' / 'public_opinion.json'
-
-
-class Textcheck:
- """文字检查,专供舆情"""
- with open(PUBLIC_OPINION_PATH, 'r+') as f:
- try:
- data = json.load(f)
- except:
- data = {}
-
- def check(self, msg: str) -> Optional[str]:
- wait_list = [keys for keys in self.data.keys()]
- for word in wait_list:
- if word in msg:
- return self.data[word]
- else:
- return "False"
-
- def add_word(self, word: str, repo: str, max_times: int,
- ban_time: int) -> Optional[str]:
- if word in self.data:
- return '相关关键词已经有啦~!'
- else:
- self.data[word] = [repo, max_times, ban_time]
- msg0 = '学習しました!\n'
- msg0 += f'Key: {word}\n'
- msg0 += f'Repo: {repo}\n'
- msg0 += f'Max times: {max_times}\n'
- msg0 += f'Ban time: {ban_time}'
- return msg0
-
- def del_word(self, word: str) -> str:
- if word in self.data:
- del self.data[word]
- return "好叻~!"
- else:
- return "未发现相关关键词呢..."
-
- def get_times(self, word: str) -> Optional[int]:
- if word not in self.data:
- return 11451406000721114514
- else:
- return self.data[word][1]