コード例 #1
0
        public async Task <bool> processFriendRequest(SteamID SteamID, Bot bot)
        {
            SteamFriends steamFriends = Client.GetHandler <SteamFriends>();
            UserProfile  userProfile  = await UserProfile.BuildUserProfile(SteamID.ConvertToUInt64(), bot);

            Logger.LogDebug("[PROFILE DETAILS]: " + userProfile.ToString());

            await processCommentedOnProfile(userProfile, bot);

            List <Action> actions = new List <Action>();

            actions.Add(processPrivateProfile(userProfile, bot));
            Logger.LogDebug("[ACTION PRIVATE PROFILE]: " + processPrivateProfile(userProfile, bot).action);

            actions.Add(await processSteamRepScammerAsync(userProfile, bot));
            Logger.LogDebug("[ACTION STAEMREP SCAMMER]: " + (await processSteamRepScammerAsync(userProfile, bot)).action);

            actions.Add(processSteamLevel(userProfile, bot));
            Logger.LogDebug("[ACTION STEAM LEVEL]: " + processSteamLevel(userProfile, bot).action);

            actions.Add(processVACBanned(userProfile, bot));
            Logger.LogDebug("[ACTION VAC BANNED]: " + processVACBanned(userProfile, bot).action);

            actions.Add(processGameBanned(userProfile, bot));
            Logger.LogDebug("[ACTION GAME BANNED]: " + processGameBanned(userProfile, bot).action);

            actions.Add(processDaysSinceLastBan(userProfile, bot));
            Logger.LogDebug("[ACTION DAYS SINCE LAST BAN]: " + processDaysSinceLastBan(userProfile, bot).action);

            actions.Add(processCommunityBanned(userProfile, bot));
            Logger.LogDebug("[ACTION COMMUNITY BANNED]: " + processCommunityBanned(userProfile, bot).action);

            actions.Add(processEconomyBanned(userProfile, bot));
            Logger.LogDebug("[ACTION ECONOMY BANNED]: " + processEconomyBanned(userProfile, bot).action);

            actions.Add(processProfileName(userProfile, bot));
            Logger.LogDebug("[ACTION PROFILE NAME]: " + processProfileName(userProfile, bot).action);

            Config.FriendInviteConfigs.TryGetValue(bot, out Config config);
            List <string> actionpriority = config.ActionPriority;

            foreach (string action_string in actionpriority)
            {
                Action action = new Action(action_string);
                if (actions.Contains(action))
                {
                    action = actions[actions.IndexOf(action)];

                    switch (action.action)
                    {
                    case "block":
                        await steamFriends.IgnoreFriend(SteamID);

                        break;

                    case "ignore":
                        steamFriends.RemoveFriend(SteamID);
                        break;

                    case "add":
                        steamFriends.AddFriend(SteamID);
                        break;
                    }

                    Logger.LogInfo("New pending invite from {0}", userProfile.personaName);
                    Logger.LogInfo("  ├─ SteamID: {0}", Convert.ToString(SteamID.ConvertToUInt64()));
                    Logger.LogInfo("  ├─ Profile url: {0}", userProfile.profileUrl);
                    Logger.LogInfo("  └─ Action: {0} | Reason: {1}", action.action.ToUpper(), action.reason);
                }
            }
            return(true);
        }