summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLint Action <[email protected]>2022-02-03 06:58:54 +0000
committerLint Action <[email protected]>2022-02-03 06:58:54 +0000
commit9a4200dc5022e1bf5a8b3228fe18251e5255e573 (patch)
tree350c88b6e5757dce56c73f9003baca29022df23d
parent110c36b86b1dbd45b4f6e5dcda5654193a0f4fb0 (diff)
downloadATRI-9a4200dc5022e1bf5a8b3228fe18251e5255e573.tar.gz
ATRI-9a4200dc5022e1bf5a8b3228fe18251e5255e573.tar.bz2
ATRI-9a4200dc5022e1bf5a8b3228fe18251e5255e573.zip
:rotating_light: 自动进行代码格式化
-rw-r--r--ATRI/config.py1
-rw-r--r--ATRI/plugins/broadcast.py30
-rw-r--r--ATRI/plugins/essential.py8
-rw-r--r--ATRI/plugins/setu/__init__.py12
-rw-r--r--ATRI/plugins/setu/data_source.py5
-rw-r--r--ATRI/utils/__init__.py2
6 files changed, 36 insertions, 22 deletions
diff --git a/ATRI/config.py b/ATRI/config.py
index b911a83..bbd5354 100644
--- a/ATRI/config.py
+++ b/ATRI/config.py
@@ -59,7 +59,6 @@ RUNTIME_CONFIG = {
"command_start": BotSelfConfig.command_start,
"command_sep": BotSelfConfig.command_sep,
"session_expire_timeout": BotSelfConfig.session_expire_timeout,
-
"gocq_accounts": InlineGoCQHTTP.accounts,
"gocq_version": InlineGoCQHTTP.download_version,
}
diff --git a/ATRI/plugins/broadcast.py b/ATRI/plugins/broadcast.py
index 0948e31..b12c050 100644
--- a/ATRI/plugins/broadcast.py
+++ b/ATRI/plugins/broadcast.py
@@ -32,7 +32,7 @@ _BROADCAST_BACK = """
class BroadCast(Service):
def __init__(self):
Service.__init__(self, "广播", "向bot所在的所有群发送信息", True, to_bot())
-
+
@staticmethod
def load_rej_list() -> list:
data = list()
@@ -41,20 +41,22 @@ class BroadCast(Service):
with open(path, "w", encoding="utf-8") as w:
w.write(json.dumps(data))
return data
-
+
return json.loads(path.read_bytes())
-
+
@classmethod
def store_rej_list(cls, data: list):
- path = BC_PATH/ "rej_list.json"
+ path = BC_PATH / "rej_list.json"
if not path.is_file():
cls.load_rej_list()
-
+
with open(path, "w", encoding="utf-8") as w:
w.write(json.dumps(data))
-caster = BroadCast().on_command("广播", "向bot所在的所有群发送信息,有防寄延迟", aliases={"/bc","bc"}, permission=SUPERUSER)
+caster = BroadCast().on_command(
+ "广播", "向bot所在的所有群发送信息,有防寄延迟", aliases={"/bc", "bc"}, permission=SUPERUSER
+)
@caster.handle()
@@ -81,20 +83,22 @@ async def _(bot: Bot, event: MessageEvent, s_msg: str = ArgPlainText("bc_msg")):
su_g.append(group_id)
except:
fl_g.append(group_id)
-
+
await asyncio.sleep(random.randint(2, 3))
-
+
repo_msg = _BROADCAST_BACK.format(
msg=s_msg,
len_g=len(w_group),
su_g=su_g,
fl_g=fl_g,
- f_g="、".join(map(str, fl_g))
+ f_g="、".join(map(str, fl_g)),
)
await caster.finish(repo_msg)
-rej_broadcast = BroadCast().on_command("拒绝广播", "拒绝来自开发者的广播推送", permission=GROUP_OWNER | GROUP_ADMIN)
+rej_broadcast = BroadCast().on_command(
+ "拒绝广播", "拒绝来自开发者的广播推送", permission=GROUP_OWNER | GROUP_ADMIN
+)
@rej_broadcast.handle()
@@ -109,12 +113,15 @@ async def _(bot: Bot, event: GroupMessageEvent):
BroadCast().store_rej_list(rej_g)
await rej_broadcast.finish("完成~!已将本群列入推送黑名单")
+
@rej_broadcast.handle()
async def _(event: PrivateMessageEvent):
await rej_broadcast.finish("该功能仅在群聊中触发...")
-acc_broadcast = BroadCast().on_command("接受广播", "接受来自开发者的广播推送", permission=GROUP_OWNER | GROUP_ADMIN)
+acc_broadcast = BroadCast().on_command(
+ "接受广播", "接受来自开发者的广播推送", permission=GROUP_OWNER | GROUP_ADMIN
+)
@acc_broadcast.handle()
@@ -129,6 +136,7 @@ async def _(bot: Bot, event: GroupMessageEvent):
else:
await rej_broadcast.finish("本群不在推送黑名单里呢...")
+
@acc_broadcast.handle()
async def _(event: PrivateMessageEvent):
await rej_broadcast.finish("该功能仅在群聊中触发...")
diff --git a/ATRI/plugins/essential.py b/ATRI/plugins/essential.py
index 6d981aa..e3919d5 100644
--- a/ATRI/plugins/essential.py
+++ b/ATRI/plugins/essential.py
@@ -24,7 +24,7 @@ from nonebot.adapters.onebot.v11 import (
GroupRecallNoticeEvent,
FriendRecallNoticeEvent,
MessageSegment,
- Message
+ Message,
)
import ATRI
@@ -302,7 +302,7 @@ async def _recall_private_event(bot: Bot, event: FriendRecallNoticeEvent):
repo = await bot.get_msg(message_id=event.message_id)
except BaseException:
return
-
+
user = event.user_id
repo: dict = repo["message"]
@@ -315,6 +315,7 @@ async def _recall_private_event(bot: Bot, event: FriendRecallNoticeEvent):
rej_recall = Essential().on_command("拒绝撤回", "拒绝撤回信息", permission=SUPERUSER)
+
@rej_recall.handle()
async def _():
global _acc_recall
@@ -324,6 +325,7 @@ async def _():
acc_recall = Essential().on_command("接受撤回", "接受撤回信息", permission=SUPERUSER)
+
@acc_recall.handle()
async def _():
global _acc_recall
@@ -349,7 +351,7 @@ def recall_msg_dealer(msg: dict) -> str:
if _type == "text":
temp_m.append(_data["text"])
elif _type == "image":
- url = _data["url"]
+ url = _data["url"]
check = MessageChecker(url).check_image_url
if check:
temp_m.append(MessageSegment.image(url))
diff --git a/ATRI/plugins/setu/__init__.py b/ATRI/plugins/setu/__init__.py
index 6c135aa..ee2fc6c 100644
--- a/ATRI/plugins/setu/__init__.py
+++ b/ATRI/plugins/setu/__init__.py
@@ -23,7 +23,9 @@ random_setu = Setu().on_command(
@random_setu.handle()
-async def _random_setu(bot: Bot, event: MessageEvent, matcher: Matcher, args: Message = CommandArg()):
+async def _random_setu(
+ bot: Bot, event: MessageEvent, matcher: Matcher, args: Message = CommandArg()
+):
user_id = event.get_user_id()
if not _setu_flmt.check(user_id):
await random_setu.finish()
@@ -49,6 +51,7 @@ async def _random_setu(bot: Bot, event: MessageEvent, matcher: Matcher, args: Me
if msg:
matcher.set_arg("r_rush_after_think", args)
+
@random_setu.got("r_rush_after_think")
async def _(think: str = ArgPlainText("r_rush_after_think")):
is_repo = will_think(think)
@@ -58,12 +61,13 @@ async def _(think: str = ArgPlainText("r_rush_after_think")):
await random_setu.finish(is_repo)
-
tag_setu = Setu().on_regex(r"来[张点丶份](.*?)的[涩色🐍]图", "根据提供的tag查找涩图")
@tag_setu.handle()
-async def _tag_setu(bot: Bot, event: MessageEvent, matcher: Matcher, args: Message = CommandArg()):
+async def _tag_setu(
+ bot: Bot, event: MessageEvent, matcher: Matcher, args: Message = CommandArg()
+):
user_id = event.get_user_id()
if not _setu_flmt.check(user_id):
await random_setu.finish()
@@ -247,7 +251,7 @@ _again_repo = ["没了...", "自己找去"]
def will_think(msg: str) -> str:
if msg in _ag_l:
return str()
-
+
ag_jud = re.findall(_ag_patt, msg)
if ag_jud:
return str()
diff --git a/ATRI/plugins/setu/data_source.py b/ATRI/plugins/setu/data_source.py
index a26bbef..d8ad00e 100644
--- a/ATRI/plugins/setu/data_source.py
+++ b/ATRI/plugins/setu/data_source.py
@@ -9,8 +9,9 @@ from .tf_dealer import detect_image
LOLICON_URL = "https://api.lolicon.app/setu/v2"
-DEFAULT_SETU = "https://i.pixiv.cat/img-original/img/2021/02/28/22/44/49/88124144_p0.jpg"
-
+DEFAULT_SETU = (
+ "https://i.pixiv.cat/img-original/img/2021/02/28/22/44/49/88124144_p0.jpg"
+)
class Setu(Service):
diff --git a/ATRI/utils/__init__.py b/ATRI/utils/__init__.py
index 480d00e..599e229 100644
--- a/ATRI/utils/__init__.py
+++ b/ATRI/utils/__init__.py
@@ -83,7 +83,7 @@ class MessageChecker:
return True
else:
return True
-
+
@property
def check_image_url(self) -> bool:
if self.tenc_gchat_url not in self.text: