2024-02-25 03:18:34 +08:00
|
|
|
import asyncio
|
|
|
|
|
|
|
|
|
|
from nonebot.adapters import Bot
|
|
|
|
|
from nonebot.matcher import Matcher
|
|
|
|
|
from nonebot.message import run_postprocessor
|
|
|
|
|
|
2024-03-27 11:53:37 +08:00
|
|
|
from zhenxun.utils.withdraw_manage import WithdrawManager
|
2024-02-25 03:18:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@run_postprocessor
|
|
|
|
|
async def _(
|
|
|
|
|
matcher: Matcher,
|
2024-03-27 11:53:37 +08:00
|
|
|
exception: Exception | None,
|
2024-02-25 03:18:34 +08:00
|
|
|
bot: Bot,
|
|
|
|
|
):
|
|
|
|
|
tasks = []
|
2024-03-27 11:53:37 +08:00
|
|
|
index_list = list(WithdrawManager._data.keys())
|
|
|
|
|
for index in index_list:
|
|
|
|
|
(
|
|
|
|
|
bot,
|
|
|
|
|
message_id,
|
|
|
|
|
time,
|
|
|
|
|
) = WithdrawManager._data[index]
|
|
|
|
|
tasks.append(
|
|
|
|
|
asyncio.ensure_future(
|
|
|
|
|
WithdrawManager.withdraw_message(bot, message_id, time)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
WithdrawManager.remove(index)
|
2024-02-25 03:18:34 +08:00
|
|
|
await asyncio.gather(*tasks)
|