mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-19 18:47:41 +08:00
* refactor: 支持在平台直接选择配置文件 * add webchat * feat: 支持新建平台时现场预览、创建和编辑配置文件 * fix: update configuration file descriptions and visibility based on updating mode * perf: use incremental decoder * perf: update descriptions * fix: UI update issues in config file dialog * fix: update UI elements for better readability and organization * feat: enhance sidebar navigation with group feature and dynamic resizing Co-authored-by: IGCrystal <3811541171@qq.com> * refactor: persona selector * perf: 修改部分默认行为 * fix: adjust ExtensionCard layout and improve responsiveness * refactor: 配置文件绑定消息平台重构为消息平台绑定配文件 * style: add custom styling for v-select selection text * fix: correct subtitle text in provider.json * refactor: update conversation management terminology and improve session ID handling * refactor: add Conversation ID localization and update table header reference * Update astrbot/core/db/migration/migra_45_to_46.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * style: format logger warning for better readability * refactor: comment out WebChat configuration for future reference --------- Co-authored-by: IGCrystal <3811541171@qq.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
"""会话ID命令"""
|
|
|
|
import astrbot.api.star as star
|
|
from astrbot.api.event import AstrMessageEvent, MessageEventResult
|
|
|
|
|
|
class SIDCommand:
|
|
"""会话ID命令类"""
|
|
|
|
def __init__(self, context: star.Context):
|
|
self.context = context
|
|
|
|
async def sid(self, event: AstrMessageEvent):
|
|
"""获取消息来源信息"""
|
|
sid = event.unified_msg_origin
|
|
user_id = str(event.get_sender_id())
|
|
umo_platform = event.session.platform_id
|
|
umo_msg_type = event.session.message_type.value
|
|
umo_session_id = event.session.session_id
|
|
ret = (
|
|
f"UMO: 「{sid}」 此值可用于设置白名单。\n"
|
|
f"UID: 「{user_id}」 此值可用于设置管理员。\n"
|
|
f"消息会话来源信息:\n"
|
|
f" 机器人 ID: 「{umo_platform}」\n"
|
|
f" 消息类型: 「{umo_msg_type}」\n"
|
|
f" 会话 ID: 「{umo_session_id}」\n"
|
|
f"消息来源可用于配置机器人的配置文件路由。"
|
|
)
|
|
|
|
if (
|
|
self.context.get_config()["platform_settings"]["unique_session"]
|
|
and event.get_group_id()
|
|
):
|
|
ret += f"\n\n当前处于独立会话模式, 此群 ID: 「{event.get_group_id()}」, 也可将此 ID 加入白名单来放行整个群聊。"
|
|
|
|
event.set_result(MessageEventResult().message(ret).use_t2i(False))
|