From 02618776008eeeb7918f376f6cc4426817d09509 Mon Sep 17 00:00:00 2001 From: TheSergiooo Date: Tue, 14 Mar 2017 07:04:34 +0300 Subject: [PATCH 1/5] Added SteamOperatorID property --- ArchiSteamFarm/Bot.cs | 27 ++++++++++++++++++--------- ArchiSteamFarm/BotConfig.cs | 3 +++ 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 2c2482ae5..e6b8503a7 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -1070,6 +1070,15 @@ namespace ArchiSteamFarm { return false; } + private bool IsOperator(ulong steamID) { + if (steamID != 0) { + return (steamID == BotConfig.SteamOperatorID) || IsMaster(steamID); + } + + ArchiLogger.LogNullError(nameof(steamID)); + return false; + } + private bool IsMasterClanID(ulong steamID) { if (steamID != 0) { return steamID == BotConfig.SteamMasterClanID; @@ -1382,7 +1391,7 @@ namespace ArchiSteamFarm { ArchiHandler.AcceptClanInvite(friend.SteamID, false); } } else { - if (IsMaster(friend.SteamID)) { + if (IsOperator(friend.SteamID)) { SteamFriends.AddFriend(friend.SteamID); } else if (BotConfig.IsBotAccount) { SteamFriends.RemoveFriend(friend.SteamID); @@ -1890,7 +1899,7 @@ namespace ArchiSteamFarm { return null; } - if (!IsMaster(steamID)) { + if (!IsOperator(steamID)) { return null; } @@ -1935,7 +1944,7 @@ namespace ArchiSteamFarm { return null; } - if (!IsMaster(steamID)) { + if (!IsOperator(steamID)) { return null; } @@ -2087,7 +2096,7 @@ namespace ArchiSteamFarm { private string ResponseHelp(ulong steamID) { if (steamID != 0) { - return IsMaster(steamID) ? FormatBotResponse("https://github.com/" + SharedInfo.GithubRepo + "/wiki/Commands") : null; + return IsOperator(steamID) ? FormatBotResponse("https://github.com/" + SharedInfo.GithubRepo + "/wiki/Commands") : null; } ArchiLogger.LogNullError(nameof(steamID)); @@ -2280,7 +2289,7 @@ namespace ArchiSteamFarm { return null; } - if (!IsMaster(steamID)) { + if (!IsOperator(steamID)) { return null; } @@ -2566,7 +2575,7 @@ namespace ArchiSteamFarm { return null; } - if (!IsMaster(steamID)) { + if (!IsOperator(steamID)) { return null; } @@ -2904,7 +2913,7 @@ namespace ArchiSteamFarm { return null; } - if (!IsMaster(steamID)) { + if (!IsOperator(steamID)) { return null; } @@ -3033,7 +3042,7 @@ namespace ArchiSteamFarm { private string ResponseUnknown(ulong steamID) { if (steamID != 0) { - return IsMaster(steamID) ? FormatBotResponse(Strings.UnknownCommand) : null; + return IsOperator(steamID) ? FormatBotResponse(Strings.UnknownCommand) : null; } ArchiLogger.LogNullError(nameof(steamID)); @@ -3056,7 +3065,7 @@ namespace ArchiSteamFarm { private string ResponseVersion(ulong steamID) { if (steamID != 0) { - return IsMaster(steamID) ? FormatBotResponse(string.Format(Strings.BotVersion, SharedInfo.ASF, SharedInfo.Version)) : null; + return IsOperator(steamID) ? FormatBotResponse(string.Format(Strings.BotVersion, SharedInfo.ASF, SharedInfo.Version)) : null; } ArchiLogger.LogNullError(nameof(steamID)); diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index 98835dedc..c28d816f8 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -100,6 +100,9 @@ namespace ArchiSteamFarm { [JsonProperty(Required = Required.DisallowNull)] internal readonly ulong SteamMasterID = 0; + [JsonProperty] + internal readonly ulong SteamOperatorID = 0; + [JsonProperty] internal readonly string SteamTradeToken = null; From 79c813025dafc47f34103c888f2bf47f532f1e4a Mon Sep 17 00:00:00 2001 From: TheSergiooo Date: Tue, 14 Mar 2017 08:15:00 +0300 Subject: [PATCH 2/5] DisallowNull fix From d96aada47adf5a45bd117d61013a9c48975f91d1 Mon Sep 17 00:00:00 2001 From: TheSergiooo Date: Tue, 14 Mar 2017 08:16:05 +0300 Subject: [PATCH 3/5] DisallowNull fix --- ArchiSteamFarm/BotConfig.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index c28d816f8..6d2dc0469 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -100,7 +100,7 @@ namespace ArchiSteamFarm { [JsonProperty(Required = Required.DisallowNull)] internal readonly ulong SteamMasterID = 0; - [JsonProperty] + [JsonProperty(Required = Required.DisallowNull)] internal readonly ulong SteamOperatorID = 0; [JsonProperty] From 9a9f7390f7102d72345f5a00a9fe648be45d6014 Mon Sep 17 00:00:00 2001 From: TheSergiooo Date: Tue, 14 Mar 2017 08:18:31 +0300 Subject: [PATCH 4/5] ConfigGenerator fix --- ConfigGenerator/BotConfig.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ConfigGenerator/BotConfig.cs b/ConfigGenerator/BotConfig.cs index 21154a3c5..597d9df31 100644 --- a/ConfigGenerator/BotConfig.cs +++ b/ConfigGenerator/BotConfig.cs @@ -116,6 +116,10 @@ namespace ConfigGenerator { [JsonProperty(Required = Required.DisallowNull)] public ulong SteamMasterID { get; set; } = 0; + [LocalizedCategory("Access")] + [JsonProperty(Required = Required.DisallowNull)] + public ulong SteamOperatorID { get; set; } = 0; + [LocalizedCategory("Access")] [JsonProperty] public string SteamParentalPIN { get; set; } = "0"; From 3be60fc638c44e479361244411be9a4927df2623 Mon Sep 17 00:00:00 2001 From: TheSergiooo Date: Tue, 14 Mar 2017 08:22:50 +0300 Subject: [PATCH 5/5] Added SteamOperatorID --- ArchiSteamFarm/config/example.json | 1 + 1 file changed, 1 insertion(+) diff --git a/ArchiSteamFarm/config/example.json b/ArchiSteamFarm/config/example.json index 29d43bc50..67d75cfdf 100644 --- a/ArchiSteamFarm/config/example.json +++ b/ArchiSteamFarm/config/example.json @@ -24,6 +24,7 @@ "SteamLogin": null, "SteamMasterClanID": 0, "SteamMasterID": 0, + "SteamOperatorID": 0, "SteamParentalPIN": "0", "SteamPassword": null, "SteamTradeToken": null,