Skip to content

Commit 6c64f2a

Browse files
committed
fix no target also require target name
1 parent 2980a33 commit 6c64f2a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

Diff for: CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- 增加了简单的单元测试
55
- 增加了管理员直接管理订阅的能力
66

7-
## [0.2.12]
7+
## [0.2.12] - 2021-06-24
88
- 微博tag支持
9+
- 修复bug
910

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "nonebot-hk-reporter"
3-
version = "0.2.11"
3+
version = "0.2.12"
44
description = "Subscribe message from social medias"
55
authors = ["felinae98 <[email protected]>"]
66
license = "MIT"

Diff for: src/plugins/nonebot_hk_reporter/config_manager.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ async def parse_platform(bot: Bot, event: Event, state: T_State) -> None:
4949
@add_sub.got('platform', '{_prompt}', parse_platform)
5050
@add_sub.handle()
5151
async def init_id(bot: Bot, event: Event, state: T_State):
52-
state['_prompt'] = '请输入订阅用户的id,详情查阅https://github.com/felinae98/nonebot-hk-reporter'
52+
if platform_manager[state['platform']].has_target:
53+
state['_prompt'] = '请输入订阅用户的id,详情查阅https://github.com/felinae98/nonebot-hk-reporter'
54+
else:
55+
state['id'] = 'default'
56+
state['name'] = await platform_manager[state['platform']].get_account_name(Target(''))
5357

5458
async def parse_id(bot: Bot, event: Event, state: T_State):
5559
target = str(event.get_message()).strip()
@@ -93,9 +97,6 @@ async def parser_tags(bot: Bot, event: Event, state: T_State):
9397
@add_sub.got('tags', '{_prompt}', parser_tags)
9498
@add_sub.handle()
9599
async def add_sub_process(bot: Bot, event: Event, state: T_State):
96-
if not platform_manager[state['platform']].has_target:
97-
state['name'] = await platform_manager[state['platform']].get_account_name(Target(''))
98-
state['id'] = 'default'
99100
config = Config()
100101
config.add_subscribe(state.get('_user_id') or event.group_id, user_type='group',
101102
target=state['id'],

0 commit comments

Comments
 (0)