mirror of
https://github.com/ChenXu233/nonebot_plugin_dialectlist.git
synced 2025-02-17 16:20:31 +08:00
🎨 格式化代码导入
This commit is contained in:
parent
d73f8afb0d
commit
84d4096af1
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@ -11,10 +11,12 @@
|
||||
"dialectlist",
|
||||
"displayname",
|
||||
"htmlrender",
|
||||
"localstore",
|
||||
"parameterless",
|
||||
"pyecharts",
|
||||
"pygal",
|
||||
"sqlalchemy",
|
||||
"timecost",
|
||||
"userinfo",
|
||||
"whereclause",
|
||||
"xaxis",
|
||||
|
@ -19,30 +19,22 @@ from arclet.alconna import ArparmaBehavior
|
||||
from arclet.alconna.arparma import Arparma
|
||||
|
||||
from nonebot.log import logger
|
||||
from nonebot.params import Arg, Depends
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.compat import model_dump
|
||||
from nonebot.adapters import Bot, Event, Message
|
||||
from nonebot.params import Arg, Depends
|
||||
from nonebot.adapters import Bot, Event
|
||||
from nonebot.permission import SUPERUSER
|
||||
from nonebot.plugin import PluginMetadata, inherit_supported_adapters
|
||||
from nonebot.typing import T_State
|
||||
from nonebot_plugin_alconna import (
|
||||
Alconna,
|
||||
AlconnaMatch,
|
||||
AlconnaMatcher,
|
||||
AlconnaQuery,
|
||||
Option,
|
||||
Args,
|
||||
Match,
|
||||
Option,
|
||||
Query,
|
||||
image_fetch,
|
||||
Alconna,
|
||||
on_alconna,
|
||||
)
|
||||
|
||||
from nonebot_plugin_chatrecorder import get_message_records
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_userinfo import get_user_info
|
||||
from nonebot_plugin_chatrecorder import get_message_records
|
||||
from nonebot_plugin_session import Session, SessionIdType, extract_session
|
||||
|
||||
# from . import migrations #抄词云的部分代码,还不知道这有什么用
|
||||
@ -58,10 +50,8 @@ from .model import UserRankInfo
|
||||
from .utils import (
|
||||
got_rank,
|
||||
msg_counter,
|
||||
persist_id2user_id,
|
||||
user_id2persist_id,
|
||||
group_id2persist_id,
|
||||
get_rank_image,
|
||||
persist_id2user_id,
|
||||
)
|
||||
|
||||
__plugin_meta__ = PluginMetadata(
|
||||
@ -300,16 +290,23 @@ async def handle_rank(
|
||||
chatdatanum=rank2[i].user_bnum,
|
||||
)
|
||||
string += str_example
|
||||
|
||||
|
||||
msg = saa.Text(string)
|
||||
|
||||
|
||||
if plugin_config.visualization:
|
||||
image = await get_rank_image(rank2)
|
||||
msg += saa.Image(image)
|
||||
|
||||
|
||||
if plugin_config.suffix:
|
||||
timecost = t.time() - state["t1"]
|
||||
suffix = saa.Text(plugin_config.string_suffix.format(timecost=timecost))
|
||||
msg += suffix
|
||||
|
||||
|
||||
await msg.finish(reply=True)
|
||||
|
||||
|
||||
@scheduler.scheduled_job(
|
||||
"dialectlist", day="*/2", id="xxx", args=[1], kwargs={"arg2": 2}
|
||||
)
|
||||
async def __():
|
||||
pass
|
||||
|
@ -1,19 +1,20 @@
|
||||
from typing import Optional, Literal, List
|
||||
from nonebot import get_driver, get_plugin_config
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from nonebot import get_driver, get_plugin_config
|
||||
|
||||
|
||||
class ScopedConfig(BaseModel):
|
||||
font: str = "SimHei" # 字体格式
|
||||
get_num: int = 5 # 获取人数数量
|
||||
timezone: Optional[str] = "Asia/Shanghai"
|
||||
excluded_self: bool = True
|
||||
string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
|
||||
template_path: str = "./template/rank_template.j2" # 模板路径
|
||||
visualization: bool = True # 是否可视化
|
||||
excluded_people: List[str] = [] # 排除的人的QQ号
|
||||
font: str = "SimHei" # 字体格式
|
||||
suffix: bool = False # 是否显示后缀
|
||||
excluded_self: bool = True
|
||||
visualization: bool = True # 是否可视化
|
||||
counting_cache: bool = True
|
||||
excluded_people: List[str] = [] # 排除的人的QQ号
|
||||
timezone: Optional[str] = "Asia/Shanghai"
|
||||
string_suffix: str = "统计花费时间:{timecost}秒" # 消息格式后缀
|
||||
template_path: str = "./template/rank_template.j2" # 模板路径
|
||||
string_format: str = "第{index}名:\n{nickname},{chatdatanum}条消息\n" # 消息格式
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
|
@ -1,6 +1,6 @@
|
||||
from typing import Optional, Literal, List, Union
|
||||
from pydantic import BaseModel
|
||||
from nonebot_plugin_userinfo import get_user_info, UserInfo
|
||||
from typing import Union
|
||||
from nonebot_plugin_orm import Model
|
||||
from nonebot_plugin_userinfo import UserInfo
|
||||
|
||||
|
||||
class UserRankInfo(UserInfo):
|
||||
@ -9,3 +9,7 @@ class UserRankInfo(UserInfo):
|
||||
user_nickname: str
|
||||
user_index: Union[int, str]
|
||||
user_avatar_bytes: bytes
|
||||
|
||||
|
||||
class MsgData(Model):
|
||||
__table_args__ = {"extend_existing": True}
|
||||
|
@ -1 +1,2 @@
|
||||
# TODO 使用计数缓存进行数据库查询优化,避免一次性查询过多消息导致内存爆炸。
|
||||
from nonebot_plugin_orm import Model
|
||||
|
@ -1,16 +1,15 @@
|
||||
# TODO 时间处理模块,用于处理时间相关操作。
|
||||
from datetime import datetime, time, tzinfo
|
||||
from typing import Optional, Union
|
||||
from zoneinfo import ZoneInfo
|
||||
from typing import Optional, Union
|
||||
from datetime import datetime, time, tzinfo
|
||||
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.params import Arg
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.adapters import Message
|
||||
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_alconna import AlconnaMatcher
|
||||
|
||||
|
||||
from .config import plugin_config
|
||||
|
||||
|
||||
|
@ -1,30 +1,24 @@
|
||||
import os
|
||||
import unicodedata
|
||||
|
||||
from typing import Optional, Dict, List, Union
|
||||
from pathlib import Path
|
||||
from typing import Dict, List
|
||||
from sqlalchemy import or_, select
|
||||
from sqlalchemy.sql import ColumnElement
|
||||
|
||||
from nonebot.log import logger
|
||||
from nonebot.params import Arg, Depends
|
||||
from nonebot.typing import T_State
|
||||
from nonebot.params import Depends
|
||||
from nonebot.matcher import Matcher
|
||||
from nonebot.adapters import Message
|
||||
|
||||
from nonebot_plugin_orm import get_session
|
||||
from nonebot_plugin_session import Session, SessionLevel, extract_session
|
||||
from nonebot_plugin_session_orm import SessionModel
|
||||
from nonebot_plugin_userinfo import EventUserInfo, UserInfo
|
||||
from nonebot_plugin_htmlrender import html_to_pic, template_to_pic
|
||||
from nonebot_plugin_apscheduler import scheduler
|
||||
from nonebot_plugin_chatrecorder import MessageRecord
|
||||
from nonebot_plugin_localstore import get_cache_dir
|
||||
from nonebot_plugin_alconna import AlconnaMatcher
|
||||
from nonebot_plugin_htmlrender import template_to_pic
|
||||
from nonebot_plugin_session_orm import SessionModel
|
||||
from nonebot_plugin_chatrecorder import MessageRecord
|
||||
|
||||
|
||||
from .config import plugin_config
|
||||
from .model import UserRankInfo
|
||||
from .config import plugin_config
|
||||
|
||||
cache_path = get_cache_dir("nonebot_plugin_dialectlist")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user