mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
Update statistics_handle.py
This commit is contained in:
parent
6014c3f975
commit
1033d585c7
@ -103,8 +103,18 @@ async def _(bot: Bot, event: MessageEvent, state: T_State):
|
||||
itype = 'month_statistics'
|
||||
else:
|
||||
itype = 'total_statistics'
|
||||
data = data[itype]["total"]
|
||||
bar_graph = await init_bar_graph(data, state["_prefix"]["raw_command"])
|
||||
tmp_dict = {}
|
||||
data = data[itype]
|
||||
for group in data.keys():
|
||||
if group != 'total':
|
||||
for day in data[group].keys():
|
||||
for plugin_name in data[group][day].keys():
|
||||
if data[group][day][plugin_name] is not None:
|
||||
if tmp_dict.get(plugin_name) is None:
|
||||
tmp_dict[plugin_name] = 1
|
||||
else:
|
||||
tmp_dict[plugin_name] += data[group][day][plugin_name]
|
||||
bar_graph = await init_bar_graph(tmp_dict, state["_prefix"]["raw_command"])
|
||||
await asyncio.get_event_loop().run_in_executor(None, bar_graph.gen_graph)
|
||||
await statistics.finish(image(b64=bar_graph.pic2bs4()))
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user