diff --git a/pyproject.toml b/pyproject.toml index 0d4d7abb..a81c8d3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Qzone3TG" -version = "0.9.4.dev2" +version = "0.9.4.dev3" description = "Forward Qzone feeds to telegram." authors = ["aioqzone "] readme = "README.md" diff --git a/src/qzone3tg/app/interact/_comment.py b/src/qzone3tg/app/interact/_comment.py index 3a54ec66..7c52881d 100644 --- a/src/qzone3tg/app/interact/_comment.py +++ b/src/qzone3tg/app/interact/_comment.py @@ -37,17 +37,27 @@ async def query_fid(mid: int): await message.reply(**COMMENT_CMD_HELP.as_kwargs()) return - match command.args.split(): + match command.args.split(maxsplit=1): case ["add", content]: if orm := await query_fid(reply.message_id): - await self.qzone.add_comment(orm.uin, orm.fid, orm.appid, content) - case ["add", "private", content]: - if orm := await query_fid(reply.message_id): - await self.qzone.add_comment(orm.uin, orm.fid, orm.appid, content, private=True) + private = False + if content.startswith("private "): + private = True + content = content.removeprefix("private").lstrip() + await self.qzone.add_comment(orm.uin, orm.fid, orm.appid, content, private=private) + await message.reply("评论成功") case ["list"]: if orm := await query_fid(reply.message_id): detail = await self.qzone.shuoshuo(orm.fid, orm.uin, orm.appid) comments = sorted(detail.comment.comments, key=lambda comment: comment.commentid) + if not comments: + await message.reply( + **Text( + "尚无评论!使用", CommandText("/command add "), "发表评论!" + ).as_kwargs() + ) + return + text = as_numbered_section( "评论:", *( @@ -55,7 +65,7 @@ async def query_fid(mid: int): for comment in comments ), ) - await message.reply(**text.as_kwargs()) + await reply.reply(**text.as_kwargs()) case _: await message.reply(**COMMENT_CMD_HELP.as_kwargs())