mirror of
https://github.com/A-Minos/nonebot-plugin-tetris-stats.git
synced 2026-03-05 05:36:54 +08:00
✨ 使用 UniMessage.finish
This commit is contained in:
@@ -93,11 +93,10 @@ async def _(bot: Bot, event: Event, matcher: Matcher, account: User, bot_info: U
|
|||||||
try:
|
try:
|
||||||
await (
|
await (
|
||||||
await proc.handle_bind(platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info)
|
await proc.handle_bind(platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info)
|
||||||
).send()
|
).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -118,11 +117,10 @@ async def _(bot: Bot, event: Event, matcher: Matcher, target: At | Me):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (UniMessage(message) + await proc.handle_query()).send()
|
await (UniMessage(message) + await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -133,11 +131,10 @@ async def _(event: Event, matcher: Matcher, account: User):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (await proc.handle_query()).send()
|
await (await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('rank')
|
@alc.assign('rank')
|
||||||
|
|||||||
@@ -87,11 +87,10 @@ async def _( # noqa: PLR0913
|
|||||||
await proc.handle_bind(
|
await proc.handle_bind(
|
||||||
platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info, user_info=user_info
|
platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info, user_info=user_info
|
||||||
)
|
)
|
||||||
).send()
|
).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -112,11 +111,10 @@ async def _(bot: Bot, event: Event, matcher: Matcher, target: At | Me):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (UniMessage(message) + await proc.handle_query()).send()
|
await (UniMessage(message) + await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -127,11 +125,10 @@ async def _(event: Event, matcher: Matcher, account: User):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (await proc.handle_query()).send()
|
await (await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
add_default_handlers(alc)
|
add_default_handlers(alc)
|
||||||
|
|||||||
@@ -73,13 +73,12 @@ alc = on_alconna(
|
|||||||
|
|
||||||
async def finish_special_query(matcher: Matcher, proc: Processor) -> NoReturn:
|
async def finish_special_query(matcher: Matcher, proc: Processor) -> NoReturn:
|
||||||
try:
|
try:
|
||||||
await (await proc.handle_query()).send()
|
await (await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
if isinstance(e, RequestError) and '未找到此用户' in e.message:
|
if isinstance(e, RequestError) and '未找到此用户' in e.message:
|
||||||
matcher.skip()
|
matcher.skip()
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -142,11 +141,10 @@ async def _(bot: Bot, event: Event, matcher: Matcher, account: User, bot_info: U
|
|||||||
try:
|
try:
|
||||||
await (
|
await (
|
||||||
await proc.handle_bind(platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info)
|
await proc.handle_bind(platform=get_platform(bot), account=event.get_user_id(), bot_info=bot_info)
|
||||||
).send()
|
).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -167,11 +165,10 @@ async def _(bot: Bot, event: Event, matcher: Matcher, target: At | Me):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (UniMessage(message) + await proc.handle_query()).send()
|
await (UniMessage(message) + await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
@alc.assign('query')
|
@alc.assign('query')
|
||||||
@@ -182,11 +179,10 @@ async def _(event: Event, matcher: Matcher, account: User):
|
|||||||
command_args=[],
|
command_args=[],
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
await (await proc.handle_query()).send()
|
await (await proc.handle_query()).finish()
|
||||||
except NeedCatchError as e:
|
except NeedCatchError as e:
|
||||||
await matcher.send(str(e))
|
await matcher.send(str(e))
|
||||||
raise HandleNotFinishedError from e
|
raise HandleNotFinishedError from e
|
||||||
await matcher.finish()
|
|
||||||
|
|
||||||
|
|
||||||
add_default_handlers(alc)
|
add_default_handlers(alc)
|
||||||
|
|||||||
Reference in New Issue
Block a user