mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 12:55:38 +00:00
🐛 groupword 增加自动安装额外包过程
This commit is contained in:
parent
35d1e710c9
commit
2e07eed811
23
groupword.py
23
groupword.py
@ -1,23 +1,42 @@
|
|||||||
import jieba
|
from asyncio import sleep
|
||||||
from wordcloud import WordCloud
|
from wordcloud import WordCloud
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
from os import makedirs
|
from os import makedirs
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from requests import get
|
from requests import get
|
||||||
from pagermaid.utils import alias_command
|
from pagermaid.utils import execute, alias_command
|
||||||
from pagermaid.listener import listener
|
from pagermaid.listener import listener
|
||||||
|
|
||||||
|
imported = True
|
||||||
punctuation = {33: ' ', 34: ' ', 35: ' ', 36: ' ', 37: ' ', 38: ' ', 39: ' ', 40: ' ', 41: ' ', 42: ' ', 43: ' ',
|
punctuation = {33: ' ', 34: ' ', 35: ' ', 36: ' ', 37: ' ', 38: ' ', 39: ' ', 40: ' ', 41: ' ', 42: ' ', 43: ' ',
|
||||||
44: ' ', 45: ' ', 46: ' ', 47: ' ', 58: ' ', 59: ' ', 60: ' ', 61: ' ', 62: ' ', 63: ' ', 64: ' ',
|
44: ' ', 45: ' ', 46: ' ', 47: ' ', 58: ' ', 59: ' ', 60: ' ', 61: ' ', 62: ' ', 63: ' ', 64: ' ',
|
||||||
91: ' ', 92: ' ', 93: ' ', 94: ' ', 95: ' ', 96: ' ', 123: ' ', 124: ' ', 125: ' ', 126: ' ',
|
91: ' ', 92: ' ', 93: ' ', 94: ' ', 95: ' ', 96: ' ', 123: ' ', 124: ' ', 125: ' ', 126: ' ',
|
||||||
65311: ' ', 65292: ' ', 65281: ' ', 12304: ' ', 12305: ' ', 65288: ' ', 65289: ' ', 12289: ' ',
|
65311: ' ', 65292: ' ', 65281: ' ', 12304: ' ', 12305: ' ', 65288: ' ', 65289: ' ', 12289: ' ',
|
||||||
12290: ' ', 65306: ' ', 65307: ' ', 8217: ' ', 8216: ' ', 8230: ' ', 65509: ' ', 183: ' '}
|
12290: ' ', 65306: ' ', 65307: ' ', 8217: ' ', 8216: ' ', 8230: ' ', 65509: ' ', 183: ' '}
|
||||||
|
try:
|
||||||
|
import jieba
|
||||||
|
except ImportError:
|
||||||
|
imported = False
|
||||||
|
|
||||||
|
|
||||||
@listener(is_plugin=True, outgoing=True, command=alias_command("groupword"),
|
@listener(is_plugin=True, outgoing=True, command=alias_command("groupword"),
|
||||||
description="拉取最新 300 条消息生成词云。")
|
description="拉取最新 300 条消息生成词云。")
|
||||||
async def group_word(context):
|
async def group_word(context):
|
||||||
|
if not imported:
|
||||||
|
try:
|
||||||
|
await context.edit("支持库 `jieba` 未安装...\n正在尝试自动安装...")
|
||||||
|
await execute('python3 -m pip install jieba')
|
||||||
|
await sleep(10)
|
||||||
|
result = await execute('python3 show jieba')
|
||||||
|
if len(result) > 0:
|
||||||
|
await context.edit('支持库 `jieba` 安装成功...\n正在尝试自动重启...')
|
||||||
|
await context.client.disconnect()
|
||||||
|
else:
|
||||||
|
await context.edit("自动安装失败..请尝试手动安装 `python3 -m pip install jieba` 随后,请重启 PagerMaid-Modify 。")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
await context.edit('正在生成中。。。')
|
await context.edit('正在生成中。。。')
|
||||||
except:
|
except:
|
||||||
|
@ -512,10 +512,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "groupword",
|
"name": "groupword",
|
||||||
"version": "1.00",
|
"version": "1.01",
|
||||||
"section": "chat",
|
"section": "chat",
|
||||||
"maintainer": "xtaodada",
|
"maintainer": "xtaodada",
|
||||||
"size": "2.41 kb",
|
"size": "3.32 kb",
|
||||||
"supported": true,
|
"supported": true,
|
||||||
"des-short": "将聊天内容生成为词云",
|
"des-short": "将聊天内容生成为词云",
|
||||||
"des": "拉取最新 300 条消息生成一张词云图片。\n\n命令:-groupword"
|
"des": "拉取最新 300 条消息生成一张词云图片。\n\n命令:-groupword"
|
||||||
|
Loading…
Reference in New Issue
Block a user