消息回复时现在使用用户名
This commit is contained in:
@@ -33,7 +33,14 @@ NewWPSBot 炼金系统。
|
|||||||
- 更改:聚合材料数量后统一校验并扣减库存
|
- 更改:聚合材料数量后统一校验并扣减库存
|
||||||
- 原因:避免重复材料扣除时出现部分扣减和异常
|
- 原因:避免重复材料扣除时出现部分扣减和异常
|
||||||
- 阻碍因素:无
|
- 阻碍因素:无
|
||||||
- 状态:未确认
|
- 状态:成功
|
||||||
|
|
||||||
|
2025-11-12_17:46:36
|
||||||
|
- 已修改:无
|
||||||
|
- 更改:收到用户确认执行成功
|
||||||
|
- 原因:流程确认
|
||||||
|
- 阻碍因素:无
|
||||||
|
- 状态:成功
|
||||||
|
|
||||||
# 最终审查
|
# 最终审查
|
||||||
(待补充)
|
(待补充)
|
||||||
|
|||||||
@@ -736,6 +736,8 @@ class MessageSender:
|
|||||||
|
|
||||||
|
|
||||||
class BasicWPSInterface(PluginInterface):
|
class BasicWPSInterface(PluginInterface):
|
||||||
|
user_id_to_username: Optional[Callable[[int], str]] = None
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def is_enable_plugin(self) -> bool:
|
def is_enable_plugin(self) -> bool:
|
||||||
return False
|
return False
|
||||||
@@ -783,10 +785,13 @@ class BasicWPSInterface(PluginInterface):
|
|||||||
if webhook_url == "" or webhook_url == None:
|
if webhook_url == "" or webhook_url == None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
result = await self.get_message_sender_function(webhook_url, self.get_message_sender_type())(f"""<at user_id="{user_id}"></at>
|
username: str = self.user_id_to_username(user_id) if self.user_id_to_username else ""
|
||||||
|
send_message = f"""## <at user_id="{user_id}">{username}</at>
|
||||||
---
|
---
|
||||||
{message}
|
{message}
|
||||||
""")
|
"""
|
||||||
|
|
||||||
|
result = await self.get_message_sender_function(webhook_url, self.get_message_sender_type())(send_message)
|
||||||
if get_internal_verbose():
|
if get_internal_verbose():
|
||||||
logger.Log("Info", f"Webhook URL: {webhook_url}, Message: {LimitStringLength(message)}, Result: {result}")
|
logger.Log("Info", f"Webhook URL: {webhook_url}, Message: {LimitStringLength(message)}, Result: {result}")
|
||||||
return None
|
return None
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ from datetime import datetime
|
|||||||
|
|
||||||
from PWF.CoreModules.plugin_interface import DatabaseModel, get_db
|
from PWF.CoreModules.plugin_interface import DatabaseModel, get_db
|
||||||
|
|
||||||
from .WPSAPI import WPSAPI
|
from .WPSAPI import *
|
||||||
|
|
||||||
logger = ProjectConfig()
|
logger = ProjectConfig()
|
||||||
CHECKIN_POINTS = logger.FindItem("checkin_points", 100)
|
CHECKIN_POINTS = logger.FindItem("checkin_points", 100)
|
||||||
@@ -74,6 +74,7 @@ class WPSConfigAPI(WPSAPI):
|
|||||||
logger.Log("Info", f"{ConsoleFrontColor.GREEN}WPSConfigAPI 插件已加载{ConsoleFrontColor.RESET}")
|
logger.Log("Info", f"{ConsoleFrontColor.GREEN}WPSConfigAPI 插件已加载{ConsoleFrontColor.RESET}")
|
||||||
self.register_plugin("config")
|
self.register_plugin("config")
|
||||||
self.register_plugin("cfg")
|
self.register_plugin("cfg")
|
||||||
|
BasicWPSInterface.user_id_to_username = self.get_user_name
|
||||||
|
|
||||||
async def do_callback(self, message: str, chat_id: int, user_id: int) -> Optional[str]:
|
async def do_callback(self, message: str, chat_id: int, user_id: int) -> Optional[str]:
|
||||||
tokens = [token.strip() for token in message.strip().split() if token.strip()]
|
tokens = [token.strip() for token in message.strip().split() if token.strip()]
|
||||||
|
|||||||
Reference in New Issue
Block a user