WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 8c4fb62

Browse files
authored
Merge pull request #327 from SK-415/dev
Release v1.5.3
2 parents 76191b2 + 058bd95 commit 8c4fb62

30 files changed

+1564
-1649
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Project ignored
22
*.sqlite3
3+
.pdm.toml
34

45
docs/.yarn
56
data/

bot.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import nonebot
2-
from nonebot.adapters.onebot.v11 import Adapter as OneBotV11Adapter
2+
from nonebot.adapters.onebot.v11 import Adapter as ONEBOT_V11Adapter
33
from nonebot.log import default_format, logger
44

55
logger.add(
@@ -12,23 +12,14 @@
1212
encoding="utf-8",
1313
)
1414

15+
1516
nonebot.init()
16-
app = nonebot.get_asgi()
1717

1818
driver = nonebot.get_driver()
19-
driver.register_adapter(OneBotV11Adapter)
20-
21-
nonebot.load_from_toml("pyproject.toml")
19+
driver.register_adapter(ONEBOT_V11Adapter)
2220

23-
# Modify some config / config depends on loaded configs
24-
#
25-
# config = driver.config
26-
# do something...
2721

22+
nonebot.load_from_toml("pyproject.toml")
2823

2924
if __name__ == "__main__":
30-
nonebot.logger.warning(
31-
"Always use `nb run` to start the bot instead of manually running!"
32-
)
33-
34-
nonebot.run(app="__mp_main__:app")
25+
nonebot.run()

docs/usage/settings.md

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,6 @@ HARUKA_DIR="./data/"
4646
Haruka_TO_ME=False
4747
```
4848

49-
## HARUKA_GUILD_ADMIN_ROLES
50-
51-
默认值:["管理员", "频道主"]
52-
53-
在频道里使用命令的身份组,可以写入多个身份组
54-
55-
```json
56-
HARUKA_GUILD_ADMIN_ROLES=["Haruka", "频道主"]
57-
```
58-
5949
## HARUKA_LIVE_OFF_NOTIFY
6050

6151
默认值:False
@@ -126,3 +116,45 @@ HARUKA_DYNAMIC_AT=True
126116
```yml
127117
HARUKA_SCREENSHOT_STYLE=pc
128118
```
119+
120+
## HARUKA_DYNAMIC_TIMEOUT
121+
122+
默认值:10
123+
124+
动态加载超时,单位秒。
125+
网络不好一直超时请调大此数值。
126+
127+
```json
128+
HARUKA_DYNAMIC_TIMEOUT=30
129+
```
130+
131+
## HARUKA_DYNAMIC_FONT
132+
133+
默认值:"Noto Sans CJK SC"
134+
135+
自定义动态截图使用的字体。只能使用系统中已经安装的字体。
136+
137+
```json
138+
HARUKA_DYNAMIC_FONT="Microsoft YaHei"
139+
```
140+
141+
## HARUKA_COMMAND_PREFIX
142+
143+
默认值:""
144+
145+
添加命令前缀,所有 HarukaBot 的命令需要带上前缀才能触发。
146+
147+
```json
148+
# 使用方式:“hb帮助”、“hb关注列表”
149+
HARUKA_COMMAND_PREFIX="hb"
150+
```
151+
152+
## HARUKA_GUILD_ADMIN_ROLES
153+
154+
默认值:["管理员", "频道主"]
155+
156+
在频道里使用命令的身份组,可以写入多个身份组
157+
158+
```json
159+
HARUKA_GUILD_ADMIN_ROLES=["Haruka", "频道主"]
160+
```

haruka_bot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
if isinstance(globals()["__loader__"], PluginLoader):
77
global_config = get_driver().config
8-
config = Config(**global_config.dict())
8+
config = Config.parse_obj(global_config)
99
from .utils import on_startup
1010

1111
on_startup()

haruka_bot/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ class Config(BaseSettings):
1616
haruka_dynamic_interval: int = 0
1717
haruka_dynamic_at: bool = False
1818
haruka_screenshot_style: str = "mobile"
19-
haruka_dynamic_font: Optional[str] = "Noto Sans CJK SC"
20-
haruka_dynamic_font_source: str = "system"
2119
haruka_dynamic_timeout: int = 10
20+
haruka_dynamic_font_source: str = "system"
21+
haruka_dynamic_font: Optional[str] = "Noto Sans CJK SC"
22+
haruka_command_prefix: str = ""
2223
# 频道管理员身份组
2324
haruka_guild_admin_roles: List[str] = ["频道主", "管理员"]
2425

haruka_bot/plugins/__init__.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
from . import ( # noqa: F401
2-
at,
3-
auto_agree,
4-
auto_delete,
5-
dynamic,
6-
help,
7-
live,
8-
permission,
9-
pusher,
10-
sub,
11-
)
1+
from . import auto_agree # noqa: F401
2+
from . import auto_delete # noqa: F401
3+
from . import help # noqa: F401
4+
from .at import at_off, at_on # noqa: F401
5+
from .dynamic import dynamic_off, dynamic_on # noqa: F401
6+
from .live import live_off, live_on # noqa: F401
7+
from .permission import permission_off, permission_on # noqa: F401
8+
from .pusher import dynamic_pusher, live_pusher # noqa: F401
9+
from .sub import add_sub, delete_sub, sub_list # noqa: F401

haruka_bot/plugins/at/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import at_off, at_on # noqa: F401

haruka_bot/plugins/at/at_off.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Union
22

3-
from nonebot import on_command
43
from nonebot.adapters.onebot.v11.event import GroupMessageEvent
54
from nonebot.adapters.onebot.v11.permission import GROUP_ADMIN, GROUP_OWNER
65
from nonebot.params import ArgPlainText
@@ -9,7 +8,15 @@
98

109
from ... import config
1110
from ...database import DB as db
12-
from ...utils import GUILD_ADMIN, get_type_id, group_only, handle_uid, to_me, uid_check
11+
from ...utils import (
12+
GUILD_ADMIN,
13+
get_type_id,
14+
group_only,
15+
handle_uid,
16+
on_command,
17+
to_me,
18+
uid_check,
19+
)
1320

1421
at_off = on_command(
1522
"关闭全体",

haruka_bot/plugins/at/at_on.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Union
22

3-
from nonebot import on_command
43
from nonebot.adapters.onebot.v11.event import GroupMessageEvent
54
from nonebot.adapters.onebot.v11.permission import GROUP_ADMIN, GROUP_OWNER
65
from nonebot.params import ArgPlainText
@@ -9,7 +8,15 @@
98

109
from ... import config
1110
from ...database import DB as db
12-
from ...utils import GUILD_ADMIN, get_type_id, group_only, handle_uid, to_me, uid_check
11+
from ...utils import (
12+
GUILD_ADMIN,
13+
get_type_id,
14+
group_only,
15+
handle_uid,
16+
on_command,
17+
to_me,
18+
uid_check,
19+
)
1320

1421
at_on = on_command(
1522
"开启全体",
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
from . import dynamic_on, dynamic_off # noqa: F401

0 commit comments

Comments
 (0)