fix: 修复myid指令在gocq平台上不可用的情况

This commit is contained in:
Soulter
2024-01-09 22:25:52 +08:00
parent 3519e38211
commit e2f1362a1f
2 changed files with 12 additions and 6 deletions
+9 -3
View File
@@ -82,7 +82,7 @@ class Command:
if self.command_start_with(message, "plugin"):
return True, self.plugin_oper(message, role, cached_plugins, platform)
if self.command_start_with(message, "myid") or self.command_start_with(message, "!myid"):
return True, self.get_my_id(message_obj)
return True, self.get_my_id(message_obj, platform)
if self.command_start_with(message, "nconf") or self.command_start_with(message, "newconf"):
return True, self.get_new_conf(message, role)
if self.command_start_with(message, "web"): # 网页搜索
@@ -105,8 +105,14 @@ class Command:
return True, "已关闭网页搜索", "web"
return True, f"网页搜索功能当前状态: {self.global_object.web_search}", "web"
def get_my_id(self, message_obj):
return True, f"你的ID{str(message_obj.sender.tiny_id)}", "plugin"
def get_my_id(self, message_obj, platform):
user_id = "Unknown"
if platform == PLATFORM_QQCHAN:
user_id = str(message_obj.sender.tiny_id)
elif platform == PLATFORM_GOCQ:
user_id = str(message_obj.user_id)
return True, f"你的ID{user_id}", "plugin"
def get_new_conf(self, message, role):
if role != "admin":