summaryrefslogtreecommitdiff
path: root/ATRI/plugins/manage/modules/broadcast.py
diff options
context:
space:
mode:
Diffstat (limited to 'ATRI/plugins/manage/modules/broadcast.py')
-rw-r--r--ATRI/plugins/manage/modules/broadcast.py42
1 files changed, 24 insertions, 18 deletions
diff --git a/ATRI/plugins/manage/modules/broadcast.py b/ATRI/plugins/manage/modules/broadcast.py
index 7f7816d..5086fcf 100644
--- a/ATRI/plugins/manage/modules/broadcast.py
+++ b/ATRI/plugins/manage/modules/broadcast.py
@@ -15,46 +15,52 @@ __doc__ = """
广播 内容
"""
-broadcast = sv.on_command(cmd="广播", docs=__doc__, permission=SUPERUSER)
-
+broadcast = sv.on_command(
+ cmd="广播",
+ docs=__doc__,
+ permission=SUPERUSER
+)
@broadcast.args_parser # type: ignore
-async def _broadcast_load(bot: Bot, event: MessageEvent, state: T_State) -> None:
+async def _broadcast_load(bot: Bot,
+ event: MessageEvent,
+ state: T_State) -> None:
msg = str(event.message)
- quit_list = ["算了", "罢了", "取消"]
+ quit_list = ['算了', '罢了', '取消']
if msg in quit_list:
- await broadcast.finish("好吧...")
+ await broadcast.finish('好吧...')
if not msg:
- await broadcast.reject("想群发啥呢0w0")
+ await broadcast.reject('想群发啥呢0w0')
else:
- state["msg"] = msg
-
+ state['msg'] = msg
@broadcast.handle()
async def _broadcast(bot: Bot, event: MessageEvent, state: T_State) -> None:
msg = str(event.message).strip()
if msg:
- state["msg"] = msg
-
-
[email protected]("msg", prompt="请告诉咱需要群发的内容~!")
-async def _deal_broadcast(bot: Bot, event: MessageEvent, state: T_State) -> None:
- msg = state["msg"]
+ state['msg'] = msg
+
[email protected]('msg', prompt='请告诉咱需要群发的内容~!')
+async def _deal_broadcast(bot: Bot,
+ event: MessageEvent,
+ state: T_State) -> None:
+ msg = state['msg']
group_list = await bot.get_group_list()
succ_list = []
err_list = []
-
+
for group in group_list:
await asyncio.sleep(randint(0, 2))
try:
- await bot.send_group_msg(group_id=group["group_id"], message=msg)
+ await bot.send_group_msg(group_id=group["group_id"],
+ message=msg)
except BaseException:
err_list.append(group["group_id"])
-
+
msg0 = ""
for i in err_list:
msg0 += f" {i}\n"
-
+
repo_msg = (
f"推送消息:\n{msg}\n"
"————————\n"