PagerMaid_Plugins/kongge.py

21 lines
550 B
Python
Raw Normal View History

2021-06-28 05:32:46 +00:00
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:
2021-06-28 05:38:54 +00:00
if context.text.startswith('-') or context.text.startswith('/'):
2021-06-28 05:37:36 +00:00
return
2021-06-28 05:32:46 +00:00
seg_list = jieba.cut(context.text)
seg_txt = ' '.join(seg_list)
2021-06-28 05:37:36 +00:00
seg_txt.replace('@ ', '@')
2021-06-28 05:32:46 +00:00
if not seg_txt == context.text:
await context.edit(seg_txt)