fix no target also require target name

This commit is contained in:
felinae98 2021-06-24 10:38:24 +08:00
parent 2980a334c4
commit 6c64f2a4e2
No known key found for this signature in database
GPG Key ID: 00C8B010587FF610
3 changed files with 8 additions and 6 deletions

View File

@ -4,6 +4,7 @@
- 增加了简单的单元测试
- 增加了管理员直接管理订阅的能力
## [0.2.12]
## [0.2.12] - 2021-06-24
- 微博tag支持
- 修复bug

View File

@ -1,6 +1,6 @@
[tool.poetry]
name = "nonebot-hk-reporter"
version = "0.2.11"
version = "0.2.12"
description = "Subscribe message from social medias"
authors = ["felinae98 <felinae225@qq.com>"]
license = "MIT"

View File

@ -49,7 +49,11 @@ def do_add_sub(add_sub: Type[Matcher]):
@add_sub.got('platform', '{_prompt}', parse_platform)
@add_sub.handle()
async def init_id(bot: Bot, event: Event, state: T_State):
state['_prompt'] = '请输入订阅用户的id详情查阅https://github.com/felinae98/nonebot-hk-reporter'
if platform_manager[state['platform']].has_target:
state['_prompt'] = '请输入订阅用户的id详情查阅https://github.com/felinae98/nonebot-hk-reporter'
else:
state['id'] = 'default'
state['name'] = await platform_manager[state['platform']].get_account_name(Target(''))
async def parse_id(bot: Bot, event: Event, state: T_State):
target = str(event.get_message()).strip()
@ -93,9 +97,6 @@ def do_add_sub(add_sub: Type[Matcher]):
@add_sub.got('tags', '{_prompt}', parser_tags)
@add_sub.handle()
async def add_sub_process(bot: Bot, event: Event, state: T_State):
if not platform_manager[state['platform']].has_target:
state['name'] = await platform_manager[state['platform']].get_account_name(Target(''))
state['id'] = 'default'
config = Config()
config.add_subscribe(state.get('_user_id') or event.group_id, user_type='group',
target=state['id'],