mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-25 18:04:12 +00:00
⚡️ groupcloud 增加分析消息数提示。
This commit is contained in:
parent
ba535f8e31
commit
6da4db8433
@ -51,7 +51,7 @@ async def group_word(context):
|
|||||||
words = defaultdict(int)
|
words = defaultdict(int)
|
||||||
count = 0
|
count = 0
|
||||||
try:
|
try:
|
||||||
async for msg in context.client.iter_messages(context.chat, limit=300):
|
async for msg in context.client.iter_messages(context.chat, limit=500):
|
||||||
if msg.id == context.id:
|
if msg.id == context.id:
|
||||||
continue
|
continue
|
||||||
if msg.text:
|
if msg.text:
|
||||||
@ -69,12 +69,16 @@ async def group_word(context):
|
|||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
try:
|
||||||
image = WordCloud(font_path="plugins/groupword/wqy-microhei.ttc", width=800, height=400).generate_from_frequencies(
|
image = WordCloud(font_path="plugins/groupword/wqy-microhei.ttc", width=800, height=400).generate_from_frequencies(
|
||||||
words).to_image()
|
words).to_image()
|
||||||
stream = BytesIO()
|
stream = BytesIO()
|
||||||
image.save(stream, 'PNG')
|
image.save(stream, 'PNG')
|
||||||
|
except:
|
||||||
|
await context.edit('词云生成失败。')
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
await context.client.send_message(context.chat, '', file=stream.getvalue())
|
await context.client.send_message(context.chat, f'对最近的 {count} 条消息进行了分析。', file=stream.getvalue())
|
||||||
await context.delete()
|
await context.delete()
|
||||||
except:
|
except:
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user