From 5dac3345c8d51f9a71d2f96f263ccc9277de332c Mon Sep 17 00:00:00 2001 From: JamzumSum Date: Tue, 28 Nov 2023 11:07:23 +0800 Subject: [PATCH] fix: failed to export emoji --- pyproject.toml | 2 +- src/qzone3tg/app/interact/_conversation/comment.py | 6 ++++++ src/qzone3tg/app/interact/_conversation/emoji.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e2aec44a..f0548eb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "Qzone3TG" -version = "0.9.5.dev9" +version = "0.9.5.dev10" description = "Forward Qzone feeds to telegram." authors = ["aioqzone "] readme = "README.md" diff --git a/src/qzone3tg/app/interact/_conversation/comment.py b/src/qzone3tg/app/interact/_conversation/comment.py index e8e9ac66..7adfec73 100644 --- a/src/qzone3tg/app/interact/_conversation/comment.py +++ b/src/qzone3tg/app/interact/_conversation/comment.py @@ -2,8 +2,10 @@ import asyncio import typing as t +from contextlib import suppress from aiogram import F, Router +from aiogram.exceptions import TelegramBadRequest from aiogram.filters import or_f from aiogram.filters.command import Command as CommandFilter from aiogram.filters.command import CommandObject @@ -58,12 +60,16 @@ async def input_content(self: InteractApp, message: Message, state: FSMContext): data = await state.get_data() feed_message = data["query_message"] await comment_core(self, feed_message, message, message.text, state) + with suppress(TelegramBadRequest): + await message.delete_reply_markup() async def cancel_custom(message: Message, state: FSMContext): if await state.get_state() is None: return await message.reply("Cancelled.", reply_markup=None) + with suppress(TelegramBadRequest): + await message.delete_reply_markup() await state.clear() diff --git a/src/qzone3tg/app/interact/_conversation/emoji.py b/src/qzone3tg/app/interact/_conversation/emoji.py index 7b39ef3b..5e9e2db7 100644 --- a/src/qzone3tg/app/interact/_conversation/emoji.py +++ b/src/qzone3tg/app/interact/_conversation/emoji.py @@ -68,7 +68,7 @@ async def em(self: InteractApp, message: Message, state: FSMContext) -> None: assert message.text is not None match message.text.split()[1:]: - case "export": + case ["export"]: await qe.export(Path("data/emoji.yml")) await message.reply(**Text("已导出到", Pre("data/emoji.yml")).as_kwargs()) case [eid] if str.isdigit(eid):