mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2024-11-22 20:17:39 +08:00
statistic适配satori
This commit is contained in:
parent
002df66878
commit
7abdac7c9c
@ -1,6 +1,7 @@
|
|||||||
from nonebot import Bot, require
|
from nonebot import Bot, require
|
||||||
from liteyuki.utils.message.npl import convert_duration, convert_time_to_seconds
|
from liteyuki.utils.message.npl import convert_duration, convert_time_to_seconds
|
||||||
from .stat_api import *
|
from .stat_api import *
|
||||||
|
from ...utils import satori_utils
|
||||||
from ...utils.base.language import Language
|
from ...utils.base.language import Language
|
||||||
from ...utils.base.ly_typing import T_MessageEvent
|
from ...utils.base.ly_typing import T_MessageEvent
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ stat_msg = on_alconna(
|
|||||||
|
|
||||||
@stat_msg.assign("message")
|
@stat_msg.assign("message")
|
||||||
async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
|
async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
|
||||||
ulang = Language(event.user_id)
|
ulang = Language(satori_utils.get_user_id(event))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
duration = convert_time_to_seconds(result.other_args.get("duration", "2d")) # 秒数
|
duration = convert_time_to_seconds(result.other_args.get("duration", "2d")) # 秒数
|
||||||
@ -57,7 +58,7 @@ async def _(result: Arparma, event: T_MessageEvent, bot: Bot):
|
|||||||
bot_id = result.other_args.get("bot_id")
|
bot_id = result.other_args.get("bot_id")
|
||||||
|
|
||||||
if group_id in ["current", "c"]:
|
if group_id in ["current", "c"]:
|
||||||
group_id = str(event.group_id)
|
group_id = str(satori_utils.get_group_id(event))
|
||||||
|
|
||||||
if group_id in ["all", "a"]:
|
if group_id in ["all", "a"]:
|
||||||
group_id = "all"
|
group_id = "all"
|
||||||
|
@ -8,3 +8,10 @@ def get_user_id(event: T_MessageEvent):
|
|||||||
return event.user.id
|
return event.user.id
|
||||||
else:
|
else:
|
||||||
return event.user_id
|
return event.user_id
|
||||||
|
|
||||||
|
|
||||||
|
def get_group_id(event: T_MessageEvent):
|
||||||
|
if isinstance(event, satori.event.Event):
|
||||||
|
return event.guild.id
|
||||||
|
else:
|
||||||
|
return event.group_id
|
||||||
|
Loading…
Reference in New Issue
Block a user