修改 OkWsBot.cs,获取玩家列表时排除自己

删除群号指定,因为在py-server.py里已经指定
This commit is contained in:
oldkingOK 2024-01-12 13:25:26 +08:00
parent 9ae3bc4d0d
commit 725510d3ef

View file

@ -24,12 +24,12 @@ public class OkWsBot : ChatBot
public class Configs { public class Configs {
public bool Enabled = true; public bool Enabled = true;
[TomlInlineComment("群号")]
public string id = "12345678";
[TomlInlineComment("Python Websocket接口")] [TomlInlineComment("Python Websocket接口")]
public string pythonSendWsApi = "ws://127.0.0.1:12345"; public string pythonSendWsApi = "ws://127.0.0.1:12345";
[TomlInlineComment("在群内显示的服务器名称")] [TomlInlineComment("在群内显示的服务器名称")]
public string serverName = "1.20"; public string serverName = "1.20";
[TomlInlineComment("在群内昵称")]
public string groupCard = "QQbot";
} }
public override void Initialize() public override void Initialize()
@ -102,8 +102,9 @@ public class OkWsBot : ChatBot
public string GetPlayerListMsg() { public string GetPlayerListMsg() {
string result = "["+Config.serverName+"]"; string result = "["+Config.serverName+"]";
string[] playerStrs = GetOnlinePlayers(); List<string> playerStrs = new List<string>(GetOnlinePlayers());
if (playerStrs.Length == 0) { playerStrs.Remove(Config.groupCard);
if (playerStrs.Count == 0) {
return result += " [鬼服]\n没有玩家在线"; return result += " [鬼服]\n没有玩家在线";
} }
result += " 在线玩家:"; result += " 在线玩家:";