From c64228bc944044c6deaf4414ee81308990e9b8f7 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Mon, 28 Jun 2021 13:32:46 +0800 Subject: [PATCH] =?UTF-8?q?kongge=20=E6=89=93=E5=AD=97=E5=B8=A6=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kongge.py | 17 +++++++++++++++++ list.json | 10 ++++++++++ 2 files changed, 27 insertions(+) create mode 100644 kongge.py diff --git a/kongge.py b/kongge.py new file mode 100644 index 0000000..92a1db6 --- /dev/null +++ b/kongge.py @@ -0,0 +1,17 @@ +from pagermaid.listener import listener + +jieba_imported = True + +try: + import jieba +except ImportError: + jieba_imported = False + + +@listener(is_plugin=True, outgoing=True, ignore_edited=True) +async def kongge(context): + if jieba_imported and context.text: + seg_list = jieba.cut(context.text) + seg_txt = ' '.join(seg_list) + if not seg_txt == context.text: + await context.edit(seg_txt) diff --git a/list.json b/list.json index c81d2d3..2535c52 100644 --- a/list.json +++ b/list.json @@ -519,6 +519,16 @@ "supported": true, "des-short": "将聊天内容生成为词云", "des": "拉取最新 300 条消息生成一张词云图片。\n\n命令:-groupword" + }, + { + "name": "kongge", + "version": "1.0", + "section": "chat", + "maintainer": "xtaodada", + "size": "4.0 kb", + "supported": true, + "des-short": "打字带空格", + "des": "需要 pypi 前置 jieba 。" } ] }