From 92431c1d3e1aa4e911a6ad8d5b7a6400d182c82a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 12 Jan 2019 18:48:00 +0100 Subject: [PATCH] Update public API of access --- .../ExamplePlugin.cs | 6 +- ArchiSteamFarm/Access.cs | 77 ---------------- ArchiSteamFarm/Bot.cs | 32 +++++-- ArchiSteamFarm/BotConfig.cs | 16 ++-- ArchiSteamFarm/Commands.cs | 88 +++++++++---------- ArchiSteamFarm/Trading.cs | 2 +- 6 files changed, 82 insertions(+), 139 deletions(-) delete mode 100644 ArchiSteamFarm/Access.cs diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs index e624e02e3..a07ede22e 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/ExamplePlugin.cs @@ -68,7 +68,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { // This method is called when unknown command is received (starting with CommandPrefix) // This allows you to recognize the command yourself and implement custom commands // Keep in mind that there is no guarantee what is the actual access of steamID, so you should do the appropriate access checking yourself - // You can use either ASF's default functions for that (using the Bot.Access), or implement your own logic as you please + // You can use either ASF's default functions for that, or implement your own logic as you please // Since ASF already had to do initial parsing in order to determine that the command is unknown, args[] are splitted using standard ASF delimiters // If by any chance you want to handle message in its raw format, you also have it available, although for usual ASF pattern you can most likely stick with args[] exclusively. The message has CommandPrefix already stripped for your convenience // If you do not recognize the command, just return null/empty and allow ASF to gracefully return "unknown command" to user on usual basis @@ -76,7 +76,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { // In comparison with OnBotMessage(), we're using asynchronous CatAPI call here, so we declare our method as async and return the message as usual switch (args[0].ToUpperInvariant()) { // Notice how we handle access here as well, it'll work only for FamilySharing+ - case "CAT" when bot.Access.IsFamilySharing(steamID): + case "CAT" when bot.HasPermission(steamID, BotConfig.EPermission.FamilySharing): // Notice how we can decide whether to use bot's AWH WebBrowser or ASF's one. For Steam-related requests, AWH's one should always be used, for third-party requests like those it doesn't really matter // Still, it makes sense to pass AWH's one, so in case you get some errors or alike, you know from which bot instance they come from. It's similar to using Bot's ArchiLogger compared to ASF's one @@ -132,7 +132,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { // Normally ASF entirely ignores such messages as the program should not respond to something that isn't recognized // Therefore this function allows you to catch all such messages and handle them yourself // Keep in mind that there is no guarantee what is the actual access of steamID, so you should do the appropriate access checking yourself - // You can use either ASF's default functions for that (using the Bot.Access), or implement your own logic as you please + // You can use either ASF's default functions for that, or implement your own logic as you please // If you do not intend to return any response to user, just return null/empty and ASF will proceed with the silence as usual public Task OnBotMessage(Bot bot, ulong steamID, string message) { // Normally ASF will expect from you async-capable responses, such as Task. This allows you to make your code fully asynchronous which is a core fundament on which ASF is built upon diff --git a/ArchiSteamFarm/Access.cs b/ArchiSteamFarm/Access.cs deleted file mode 100644 index fe799d8df..000000000 --- a/ArchiSteamFarm/Access.cs +++ /dev/null @@ -1,77 +0,0 @@ -// _ _ _ ____ _ _____ -// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___ -// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \ -// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | | -// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_| -// -// Copyright 2015-2019 Łukasz "JustArchi" Domeradzki -// Contact: JustArchi@JustArchi.net -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using ArchiSteamFarm.Collections; -using JetBrains.Annotations; - -namespace ArchiSteamFarm { - public sealed class Access { - internal readonly ConcurrentHashSet SteamFamilySharingIDs = new ConcurrentHashSet(); - - private readonly Bot Bot; - - internal Access([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot)); - - [PublicAPI] - public bool IsFamilySharing(ulong steamID) { - if (steamID == 0) { - Bot.ArchiLogger.LogNullError(nameof(steamID)); - - return false; - } - - return ASF.IsOwner(steamID) || SteamFamilySharingIDs.Contains(steamID) || (GetSteamUserPermission(steamID) >= BotConfig.EPermission.FamilySharing); - } - - [PublicAPI] - public bool IsMaster(ulong steamID) { - if (steamID == 0) { - Bot.ArchiLogger.LogNullError(nameof(steamID)); - - return false; - } - - return ASF.IsOwner(steamID) || (GetSteamUserPermission(steamID) >= BotConfig.EPermission.Master); - } - - [PublicAPI] - public bool IsOperator(ulong steamID) { - if (steamID == 0) { - Bot.ArchiLogger.LogNullError(nameof(steamID)); - - return false; - } - - return ASF.IsOwner(steamID) || (GetSteamUserPermission(steamID) >= BotConfig.EPermission.Operator); - } - - private BotConfig.EPermission GetSteamUserPermission(ulong steamID) { - if (steamID == 0) { - Bot.ArchiLogger.LogNullError(nameof(steamID)); - - return BotConfig.EPermission.None; - } - - return Bot.BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission permission) ? permission : BotConfig.EPermission.None; - } - } -} diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 6b6d3f655..002bf6e86 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -31,6 +31,7 @@ using System.Security.Cryptography; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using ArchiSteamFarm.Collections; using ArchiSteamFarm.Localization; using ArchiSteamFarm.NLog; using ArchiSteamFarm.Plugins; @@ -63,9 +64,6 @@ namespace ArchiSteamFarm { private static RegexOptions BotsRegex; - [PublicAPI] - public readonly Access Access; - [PublicAPI] public readonly Actions Actions; @@ -111,6 +109,7 @@ namespace ArchiSteamFarm { private readonly SemaphoreSlim PICSSemaphore = new SemaphoreSlim(1, 1); private readonly Statistics Statistics; private readonly SteamClient SteamClient; + private readonly ConcurrentHashSet SteamFamilySharingIDs = new ConcurrentHashSet(); private readonly SteamUser SteamUser; private readonly Trading Trading; @@ -259,7 +258,6 @@ namespace ArchiSteamFarm { CallbackManager.Subscribe(OnUserNotifications); CallbackManager.Subscribe(OnVanityURLChangedCallback); - Access = new Access(this); Actions = new Actions(this); CardsFarmer = new CardsFarmer(this); Commands = new Commands(this); @@ -300,6 +298,28 @@ namespace ArchiSteamFarm { Trading?.Dispose(); } + [PublicAPI] + public bool HasPermission(ulong steamID, BotConfig.EPermission permission) { + if ((steamID == 0) || (permission == BotConfig.EPermission.None)) { + ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(permission)); + + return false; + } + + if (ASF.IsOwner(steamID)) { + return true; + } + + switch (permission) { + case BotConfig.EPermission.FamilySharing when SteamFamilySharingIDs.Contains(steamID): + + return true; + default: + + return BotConfig.SteamUserPermissions.TryGetValue(steamID, out BotConfig.EPermission realPermission) && (realPermission >= permission); + } + } + internal async Task AddGamesToRedeemInBackground(IOrderedDictionary gamesToRedeemInBackground) { if ((gamesToRedeemInBackground == null) || (gamesToRedeemInBackground.Count == 0)) { ArchiLogger.LogNullError(nameof(gamesToRedeemInBackground)); @@ -1527,7 +1547,7 @@ namespace ArchiSteamFarm { return; } - Access.SteamFamilySharingIDs.ReplaceIfNeededWith(steamIDs); + SteamFamilySharingIDs.ReplaceIfNeededWith(steamIDs); } private bool InitLoginAndPassword(bool requiresPassword) { @@ -1866,7 +1886,7 @@ namespace ArchiSteamFarm { break; default: - if (Access.IsFamilySharing(friend.SteamID)) { + if (HasPermission(friend.SteamID, BotConfig.EPermission.FamilySharing)) { await ArchiHandler.AddFriend(friend.SteamID).ConfigureAwait(false); } else if (BotConfig.BotBehaviour.HasFlag(BotConfig.EBotBehaviour.RejectInvalidFriendInvites)) { await ArchiHandler.RemoveFriend(friend.SteamID).ConfigureAwait(false); diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index 6dab78aef..229079976 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -148,7 +148,6 @@ namespace ArchiSteamFarm { [JsonExtensionData] internal Dictionary AdditionalProperties { get; - [UsedImplicitly] private set; } @@ -371,6 +370,14 @@ namespace ArchiSteamFarm { return true; } + [PublicAPI] + public enum EPermission : byte { + None, + FamilySharing, + Operator, + Master + } + [Flags] internal enum EBotBehaviour : byte { None = 0, @@ -401,13 +408,6 @@ namespace ArchiSteamFarm { MarketableDescending } - internal enum EPermission : byte { - None, - FamilySharing, - Operator, - Master - } - [Flags] internal enum ERedeemingPreferences : byte { None = 0, diff --git a/ArchiSteamFarm/Commands.cs b/ArchiSteamFarm/Commands.cs index 33d3060e8..7ce3b88e0 100644 --- a/ArchiSteamFarm/Commands.cs +++ b/ArchiSteamFarm/Commands.cs @@ -385,7 +385,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -426,7 +426,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -471,7 +471,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsOperator(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return null; } @@ -518,7 +518,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsOperator(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return null; } @@ -573,7 +573,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -622,7 +622,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsOperator(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return null; } @@ -705,7 +705,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -783,7 +783,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -820,7 +820,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -873,7 +873,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -942,7 +942,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -987,7 +987,7 @@ namespace ArchiSteamFarm { return null; } - return Bot.Access.IsFamilySharing(steamID) ? FormatBotResponse(SharedInfo.ProjectURL + "/wiki/Commands") : null; + return Bot.HasPermission(steamID, BotConfig.EPermission.FamilySharing) ? FormatBotResponse(SharedInfo.ProjectURL + "/wiki/Commands") : null; } private string ResponseIdleBlacklist(ulong steamID) { @@ -997,7 +997,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1034,7 +1034,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1087,7 +1087,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1140,7 +1140,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1177,7 +1177,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1230,7 +1230,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1283,7 +1283,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1332,7 +1332,7 @@ namespace ArchiSteamFarm { return FormatBotResponse(Strings.BotNotConnected); } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1369,7 +1369,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1414,7 +1414,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1475,7 +1475,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1516,7 +1516,7 @@ namespace ArchiSteamFarm { return (null, null); } - if (!Bot.Access.IsOperator(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return (null, null); } @@ -1636,7 +1636,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1680,11 +1680,11 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsFamilySharing(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.FamilySharing)) { return null; } - if (permanent && !Bot.Access.IsOperator(steamID)) { + if (permanent && !Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return FormatBotResponse(Strings.ErrorAccessDenied); } @@ -1727,7 +1727,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1751,7 +1751,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1813,7 +1813,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -1965,7 +1965,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsOperator(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Operator)) { return null; } @@ -1995,7 +1995,7 @@ namespace ArchiSteamFarm { while (!string.IsNullOrEmpty(key)) { string startingKey = key; - using (IEnumerator botsEnumerator = Bot.Bots.Where(bot => (bot.Value != Bot) && !rateLimitedBots.Contains(bot.Value) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.Access.IsOperator(steamID)).OrderBy(bot => bot.Key).Select(bot => bot.Value).GetEnumerator()) { + using (IEnumerator botsEnumerator = Bot.Bots.Where(bot => (bot.Value != Bot) && !rateLimitedBots.Contains(bot.Value) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.HasPermission(steamID, BotConfig.EPermission.Operator)).OrderBy(bot => bot.Key).Select(bot => bot.Value).GetEnumerator()) { Bot currentBot = Bot; while (!string.IsNullOrEmpty(key) && (currentBot != null)) { @@ -2076,7 +2076,7 @@ namespace ArchiSteamFarm { bool alreadyHandled = false; - foreach (Bot innerBot in Bot.Bots.Where(bot => (bot.Value != currentBot) && (!redeemFlags.HasFlag(ERedeemFlags.SkipInitial) || (bot.Value != Bot)) && !rateLimitedBots.Contains(bot.Value) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.Access.IsOperator(steamID) && ((items.Count == 0) || items.Keys.Any(packageID => !bot.Value.OwnedPackageIDs.ContainsKey(packageID)))).OrderBy(bot => bot.Key).Select(bot => bot.Value)) { + foreach (Bot innerBot in Bot.Bots.Where(bot => (bot.Value != currentBot) && (!redeemFlags.HasFlag(ERedeemFlags.SkipInitial) || (bot.Value != Bot)) && !rateLimitedBots.Contains(bot.Value) && bot.Value.IsConnectedAndLoggedOn && bot.Value.Commands.Bot.HasPermission(steamID, BotConfig.EPermission.Operator) && ((items.Count == 0) || items.Keys.Any(packageID => !bot.Value.OwnedPackageIDs.ContainsKey(packageID)))).OrderBy(bot => bot.Key).Select(bot => bot.Value)) { ArchiHandler.PurchaseResponseCallback otherResult = await innerBot.Actions.RedeemKey(key).ConfigureAwait(false); if (otherResult == null) { @@ -2209,7 +2209,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsFamilySharing(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.FamilySharing)) { return null; } @@ -2246,7 +2246,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2299,7 +2299,7 @@ namespace ArchiSteamFarm { return (null, Bot); } - if (!Bot.Access.IsFamilySharing(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.FamilySharing)) { return (null, Bot); } @@ -2372,7 +2372,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2409,7 +2409,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2466,7 +2466,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2498,7 +2498,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2572,7 +2572,7 @@ namespace ArchiSteamFarm { return null; } - return Bot.Access.IsOperator(steamID) ? FormatBotResponse(Strings.UnknownCommand) : null; + return Bot.HasPermission(steamID, BotConfig.EPermission.Operator) ? FormatBotResponse(Strings.UnknownCommand) : null; } private async Task ResponseUnpackBoosters(ulong steamID) { @@ -2582,7 +2582,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } @@ -2649,7 +2649,7 @@ namespace ArchiSteamFarm { return null; } - return Bot.Access.IsOperator(steamID) ? FormatBotResponse(string.Format(Strings.BotVersion, SharedInfo.ASF, SharedInfo.Version)) : null; + return Bot.HasPermission(steamID, BotConfig.EPermission.Operator) ? FormatBotResponse(string.Format(Strings.BotVersion, SharedInfo.ASF, SharedInfo.Version)) : null; } private string ResponseWalletBalance(ulong steamID) { @@ -2659,7 +2659,7 @@ namespace ArchiSteamFarm { return null; } - if (!Bot.Access.IsMaster(steamID)) { + if (!Bot.HasPermission(steamID, BotConfig.EPermission.Master)) { return null; } diff --git a/ArchiSteamFarm/Trading.cs b/ArchiSteamFarm/Trading.cs index 8137a3eb8..714ee457f 100644 --- a/ArchiSteamFarm/Trading.cs +++ b/ArchiSteamFarm/Trading.cs @@ -526,7 +526,7 @@ namespace ArchiSteamFarm { if (tradeOffer.OtherSteamID64 != 0) { // Always accept trades from SteamMasterID - if (Bot.Access.IsMaster(tradeOffer.OtherSteamID64)) { + if (Bot.HasPermission(tradeOffer.OtherSteamID64, BotConfig.EPermission.Master)) { return new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.Accepted, tradeOffer.ItemsToReceive); }