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 。" } ] }