mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-04 03:10:01 +08:00
🐛 修复sqlite下的日统计查询和0权限功能调用 (#1943)
This commit is contained in:
@@ -80,14 +80,14 @@ class PlatformUtils:
|
||||
@classmethod
|
||||
async def send_superuser(
|
||||
cls,
|
||||
bot: Bot,
|
||||
bot: Bot | None,
|
||||
message: UniMessage | str,
|
||||
superuser_id: str | None = None,
|
||||
) -> list[tuple[str, Receipt]]:
|
||||
"""发送消息给超级用户
|
||||
|
||||
参数:
|
||||
bot: Bot
|
||||
bot: Bot,没有传入时使用get_bot随机获取
|
||||
message: 消息
|
||||
superuser_id: 指定超级用户id.
|
||||
|
||||
@@ -97,6 +97,8 @@ class PlatformUtils:
|
||||
返回:
|
||||
Receipt | None: Receipt
|
||||
"""
|
||||
if not bot:
|
||||
bot = nonebot.get_bot()
|
||||
superuser_ids = []
|
||||
if superuser_id:
|
||||
superuser_ids.append(superuser_id)
|
||||
|
||||
+18
-1
@@ -1,5 +1,5 @@
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from datetime import date, datetime
|
||||
import os
|
||||
from pathlib import Path
|
||||
import time
|
||||
@@ -244,3 +244,20 @@ def is_number(text: str) -> bool:
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
class TimeUtils:
|
||||
@classmethod
|
||||
def get_day_start(cls, target_date: date | datetime | None = None) -> datetime:
|
||||
"""获取某天的0点时间
|
||||
|
||||
返回:
|
||||
datetime: 今天某天的0点时间
|
||||
"""
|
||||
if not target_date:
|
||||
target_date = datetime.now()
|
||||
return (
|
||||
target_date.replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
if isinstance(target_date, datetime)
|
||||
else datetime.combine(target_date, datetime.min.time())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user