📝 将从事件中获取信息的工具函数移动到单独的 utils.event

This commit is contained in:
Expliyh
2024-05-17 15:00:01 +08:00
parent 077658c68d
commit 309397b72c
12 changed files with 39 additions and 44 deletions

View File

@ -0,0 +1 @@
from .get_info import *

View File

@ -15,3 +15,10 @@ def get_group_id(event: T_MessageEvent):
return event.guild.id
else:
return event.group_id
def get_message_type(event: T_MessageEvent) -> str:
if isinstance(event, satori.event.Event):
return "private" if event.guild is None else "group"
else:
return event.message_type

View File

@ -1,5 +1,3 @@
from .user_info import user_infos
from .get_message_type import get_message_type
from .event_tools import *
from .count_friends import count_friends
from .count_groups import count_groups

View File

@ -1,10 +0,0 @@
from nonebot.adapters import satori
from liteyuki.utils.base.ly_typing import T_MessageEvent
def get_message_type(event: T_MessageEvent) -> str:
if isinstance(event, satori.event.Event):
return "private" if event.guild is None else "group"
else:
return event.message_type