mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-02 18:20:01 +08:00
Merge branch 'HibiKier:main' into main
This commit is contained in:
@@ -149,12 +149,12 @@ async def _remind(user_id: int, uid: str):
|
||||
if current_resin < max_resin:
|
||||
user_manager.remove(uid)
|
||||
user_manager.remove_overflow(uid)
|
||||
if current_resin <= max_resin - 40:
|
||||
next_time = now + timedelta(minutes=(max_resin - 40 - current_resin + 1) * 8, seconds=10)
|
||||
elif max_resin - 40 < current_resin <= max_resin - 20:
|
||||
next_time = now + timedelta(minutes=(max_resin - 20 - current_resin + 1) * 8, seconds=10)
|
||||
elif max_resin - 20 < current_resin < max_resin:
|
||||
next_time = now + timedelta(minutes=(max_resin - current_resin) * 8, seconds=10)
|
||||
if current_resin < max_resin - 40:
|
||||
next_time = now + timedelta(minutes=(max_resin - 40 - current_resin) * 8)
|
||||
elif max_resin - 40 <= current_resin < max_resin - 20:
|
||||
next_time = now + timedelta(minutes=(max_resin - 20 - current_resin) * 8)
|
||||
elif max_resin - 20 <= current_resin < max_resin:
|
||||
next_time = now + timedelta(minutes=(max_resin - current_resin) * 8)
|
||||
elif current_resin == max_resin:
|
||||
custom_overflow_resin = Config.get_config("resin_remind", "CUSTOM_RESIN_OVERFLOW_REMIND")
|
||||
if user_manager.is_overflow(uid) and custom_overflow_resin:
|
||||
|
||||
+25
-15
@@ -1,20 +1,30 @@
|
||||
from configs.config import Config as gConfig
|
||||
from .api import *
|
||||
from .auth import *
|
||||
|
||||
|
||||
gConfig.add_plugin_config(
|
||||
"web-ui",
|
||||
"username",
|
||||
"admin",
|
||||
name="web-ui",
|
||||
help_="前端管理用户名"
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.message import run_preprocessor, IgnoredException
|
||||
from utils.manager import plugins2settings_manager
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters.onebot.v11 import (
|
||||
Bot,
|
||||
MessageEvent
|
||||
)
|
||||
|
||||
gConfig.add_plugin_config(
|
||||
"web-ui",
|
||||
"password",
|
||||
None,
|
||||
name="web-ui",
|
||||
help_="前端管理密码"
|
||||
)
|
||||
|
||||
gConfig.add_plugin_config("web-ui", "username", "admin", name="web-ui", help_="前端管理用户名")
|
||||
|
||||
gConfig.add_plugin_config("web-ui", "password", None, name="web-ui", help_="前端管理密码")
|
||||
|
||||
|
||||
# 使用webui访问api后plugins2settings中的cmd字段将从list变为str
|
||||
# 暂时找不到原因
|
||||
# 先使用hook修复
|
||||
@run_preprocessor
|
||||
async def _(matcher: Matcher, bot: Bot, event: MessageEvent, state: T_State):
|
||||
for module in plugins2settings_manager.keys():
|
||||
if isinstance(plugins2settings_manager.get_plugin_data(module).get("cmd"), str):
|
||||
plugins2settings_manager.set_module_data(
|
||||
module,
|
||||
"cmd",
|
||||
plugins2settings_manager.get_plugin_data(module).get("cmd").split(","),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user