⬆️✨ Upgrade telethon, Refine session statistics, Support edit git source. (#99)
⬆️ 提升 telethon 依赖版本。 ✨ 细化会话数统计。 ✨ 支持自定义插件来源(cdn)。
This commit is contained in:
parent
741296cc74
commit
73a80f5970
@ -368,6 +368,16 @@ status_python: Python version
|
||||
status_telethon: Telethon version
|
||||
status_db: database status
|
||||
status_dialogs: total number of conversations
|
||||
# stats
|
||||
stats_des: View conversation statistics.
|
||||
stats_loading: Loading...
|
||||
stats_hint: Conversations Status
|
||||
stats_dialogs: Total
|
||||
stats_private: PM
|
||||
stats_group: Group
|
||||
stats_supergroup: SuperGroup
|
||||
stats_channel: Channel
|
||||
stats_bot: Bot
|
||||
# speedtest
|
||||
speedtest_des: Execute the speedtest script and send the result.
|
||||
speedtest_processing: Execute test scripts...
|
||||
|
@ -382,7 +382,16 @@ status_release: Kernel 版本
|
||||
status_python: Python 版本
|
||||
status_telethon: Telethon 版本
|
||||
status_db: 数据库状态
|
||||
status_dialogs: 对话总数
|
||||
## stats
|
||||
stats_des: 查看我的对话统计信息。
|
||||
stats_loading: 加载中 . . .
|
||||
stats_hint: 对话统计
|
||||
stats_dialogs: 对话总数
|
||||
stats_private: 您拥有的私聊数为
|
||||
stats_group: 您拥有的普通群组数为
|
||||
stats_supergroup: 您拥有的超级群组数为
|
||||
stats_channel: 您拥有的频道数为
|
||||
stats_bot: 您激活的机器人数为
|
||||
## speedtest
|
||||
speedtest_des: 执行 speedtest 脚本并发送结果。
|
||||
speedtest_processing: 执行测试脚本 . . .
|
||||
|
@ -363,6 +363,16 @@ status_python: Python版本
|
||||
status_telethon: Telethon版本
|
||||
status_db: 數據庫狀態
|
||||
status_dialogs: 聊天總數
|
||||
# stats
|
||||
stats_des: 查看我的對話統計信息。
|
||||
stats_loading: 加載中 . . .
|
||||
stats_hint: 對話統計
|
||||
stats_dialogs: 對話總數
|
||||
stats_private: 您擁有的私聊數為
|
||||
stats_group: 您擁有的普通群組數為
|
||||
stats_supergroup: 您擁有的超級群組數為
|
||||
stats_channel: 您擁有的頻道數為
|
||||
stats_bot: 您激活的機器人數為
|
||||
# speedtest
|
||||
speedtest_des: 執行Speedtest腳本然後發送結果
|
||||
speedtest_processing: 執行腳本
|
||||
|
@ -11,6 +11,7 @@ from telethon import functions
|
||||
from platform import python_version, uname
|
||||
from wordcloud import WordCloud
|
||||
from telethon import version as telethon_version
|
||||
from telethon.tl.types import User, Chat, Channel
|
||||
from sys import platform
|
||||
from re import sub, findall
|
||||
from pathlib import Path
|
||||
@ -92,9 +93,39 @@ async def status(context):
|
||||
f"{lang('status_db')}: `{database}`"
|
||||
)
|
||||
await context.edit(text)
|
||||
dialogs = await context.client.get_dialogs()
|
||||
dialogs = len(dialogs)
|
||||
text += f"\n{lang('status_dialogs')}: `{dialogs}`"
|
||||
|
||||
|
||||
@listener(is_plugin=False, outgoing=True, command=alias_command("stats"),
|
||||
description=lang('stats_des'))
|
||||
async def stats(context):
|
||||
await context.edit(lang('stats_loading'))
|
||||
u, g, s, c, b = 0, 0, 0, 0, 0
|
||||
dialogs = await context.client.get_dialogs(
|
||||
limit=None,
|
||||
ignore_migrated=True
|
||||
)
|
||||
for d in dialogs:
|
||||
current_entity = d.entity
|
||||
if type(current_entity) is User:
|
||||
if current_entity.bot:
|
||||
b += 1
|
||||
else:
|
||||
u += 1
|
||||
elif type(current_entity) is Chat:
|
||||
g += 1
|
||||
elif type(current_entity) is Channel:
|
||||
if current_entity.broadcast:
|
||||
c += 1
|
||||
else:
|
||||
s += 1
|
||||
text = (f"**{lang('stats_hint')}** \n"
|
||||
f"{lang('stats_dialogs')}: `{len(dialogs)}` \n"
|
||||
f"{lang('stats_private')}: `{u}` \n"
|
||||
f"{lang('stats_group')}: `{g}` \n"
|
||||
f"{lang('stats_supergroup')}: `{s}` \n"
|
||||
f"{lang('stats_channel')}: `{c}` \n"
|
||||
f"{lang('stats_bot')}: `{b}`"
|
||||
)
|
||||
await context.edit(text)
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ translate>=3.5.0
|
||||
gTTS>=2.2.2
|
||||
gTTS-token>=1.1.4
|
||||
wordcloud>=1.8.1
|
||||
Telethon>=1.21.1
|
||||
Telethon>=1.22.0
|
||||
Pillow>=8.2.0
|
||||
python-magic>=0.4.24
|
||||
Pygments>=2.9.0
|
||||
|
Loading…
Reference in New Issue
Block a user