From e51ab984fd1821736a9a3ae0b1a1abebe2201890 Mon Sep 17 00:00:00 2001 From: Ching Date: Fri, 21 Jan 2022 00:54:46 +0800 Subject: [PATCH] =?UTF-8?q?fix(dodo):=20=E4=BF=AE=E5=A4=8D=E6=8C=87?= =?UTF-8?q?=E4=BB=A4=E8=AF=86=E5=88=AB=E6=9C=89=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复指令识别有误的问题 Signed-off-by: Ching --- recipe/models.py | 4 +++- scripts/dodo.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/recipe/models.py b/recipe/models.py index ca63d95..6065a26 100644 --- a/recipe/models.py +++ b/recipe/models.py @@ -97,7 +97,9 @@ class Recipe(models.Model): "elements": [ { "tag": "markdown", - "content": "# **%s**\n类型:%s\n难度:%s\n评分:%s" % (self.name, self.display_recipe_type, self.display_difficult, self.display_rate) + "content": "# **%s**\n类型:%s\n评分:%s\n难度:%s" % ( + self.name, self.display_recipe_type, self.display_rate, + self.display_difficult) }, { "tag": "action", diff --git a/scripts/dodo.py b/scripts/dodo.py index 5fca71b..2359424 100644 --- a/scripts/dodo.py +++ b/scripts/dodo.py @@ -201,11 +201,14 @@ class RequestHandler(BaseHTTPRequestHandler): if orig_text.startswith('/'): redis_cli.set(event_id, int(time.time()), ex=60*60*7) if orig_text not in ['/last', '/del']: + flag = False for action_ in ['/deploy ', '/菜谱 ']: if orig_text.startswith(action_): + flag = True break - self.msg_compoment(access_token, open_id, '指令错误') - return + if not flag: + self.msg_compoment(access_token, open_id, '指令错误') + return if orig_text == '/last': try: statuses = mastodon_cli.account_statuses(KEDAI_ID, limit=1)