Exemple #1
0
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            if (callback == null)
            {
                return;
            }

            foreach (var friend in callback.FriendList)
            {
                if (friend.Relationship != EFriendRelationship.RequestRecipient)
                {
                    continue;
                }

                SteamID steamID = friend.SteamID;
                switch (steamID.AccountType)
                {
                case EAccountType.Clan:
                    //ArchiHandler.AcceptClanInvite(steamID);
                    break;

                default:
                    if (steamID == SteamMasterID)
                    {
                        SteamFriends.AddFriend(steamID);
                    }
                    else
                    {
                        SteamFriends.RemoveFriend(steamID);
                    }
                    break;
                }
            }
        }
Exemple #2
0
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            // TODO: Auto-join chatrooms here?

            // Start game
            kraxbot.PlayGame(205);
        }
Exemple #3
0
        static void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            int friendCount = steamFriends.GetFriendCount();

            Console.WriteLine("We have {0} friends", friendCount);

            foreach (var friend in callback.FriendList)
            {
                friendList.Add(friend.SteamID);
            }
        }
Exemple #4
0
 private void OnSteamFriendsList(SteamFriends.FriendsListCallback callback)
 {
     //List of friends received, accept all friend requests
     foreach (var friend in callback.FriendList)
     {
         if (friend.Relationship == EFriendRelationship.RequestRecipient)
         {
             m_steamFriends.AddFriend(friend.SteamID);
         }
     }
 }
Exemple #5
0
        void OnFriendsList(SteamFriends.FriendsListCallback callback)         // Получаем список друзей в аккаунте бота
        {
            foreach (var friend in callback.FriendList)
            {
                Console.WriteLine($"Друзья: {friend.SteamID}");

                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    steamFriends.AddFriend(friend.SteamID);
                }
            }
        }
        /// <summary>
        /// The callback that is fired when going online once connected to steam, we use it to tell the
        /// userhandler class to run its login method
        /// </summary>
        /// <param name="callback"></param>
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            // at this point, the client has received it's friends list
            Console.WriteLine("Steam Logged in");

            AnnounceLoginCompleted();

            foreach (ChatroomEntity Chatroom in GetMainChatroomsCollection())
            {
                SteamID ChatroomToJoin = ConvertEntityToSteamID(Chatroom);
                SteamFriends.JoinChat(ChatroomToJoin);
            }
        }
Exemple #7
0
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            Console.WriteLine("Getting Friends List...");

            foreach (var friend in callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    Console.WriteLine("Adding Friend {0}.", friend.SteamID);
                    SteamFriends.AddFriend(friend.SteamID);
                }
            }
        }
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            Console.WriteLine($"We have {SteamFriends.GetFriendCount()} friends");

            foreach (var friend in callback.FriendList)
            {
                SteamID steamIdFriend = friend.SteamID;
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    SteamFriends.AddFriend(steamIdFriend);
                }
                Console.WriteLine($"Friend: {steamIdFriend.Render()}");
            }
        }
Exemple #9
0
 static void OnFriendList(SteamFriends.FriendsListCallback callback)
 {
     Thread.Sleep(3000);
     foreach (var friend in callback.FriendList)
     {
         if (friend.Relationship == EFriendRelationship.RequestRecipient)
         {
             steamFriends.AddFriend(friend.SteamID);
             Console.WriteLine("Accepted friend request of " + steamFriends.GetFriendPersonaName(friend.SteamID));
             Thread.Sleep(500);
             steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg, "Nice to meet you! I am a steam bot");
         }
     }
 }
Exemple #10
0
        static void onFriendList(SteamFriends.FriendsListCallback callback)
        {
            int friendCount = steamFriends.GetFriendCount();

            Console.WriteLine("You have {0} friends", friendCount);

            foreach (var friend in callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    steamFriends.AddFriend(friend.SteamID);
                }
            }
        }
Exemple #11
0
 static void OnFriendsList(SteamFriends.FriendsListCallback callback)
 {
     //We need to make the program sleep for a little bit so it has time to cache all the names, if you don't add this part strange things will happen.
     Thread.Sleep(2500);
     Random timing      = new Random();
     int    nexttime    = timing.Next(30, 60);
     Random rnd         = new Random();
     Random who         = new Random();
     var    friendtimer = new System.Threading.Timer((e) => {
         List <SteamID> ids = new List <SteamID> ();
         int count          = 0;
         nexttime           = timing.Next(45, 75);
         //here we will create a foreach loop that will go through our callback.FriendsList and check to see if one of the friends is really someone who wants to be our friend
         //and if so, to add them
         //var is basically a variable declaration for something you don't know will be.
         foreach (var friend in callback.FriendList)
         {
             //checks our friend relationship to check if they sent a friend request and aren't just a friend already on the list.
             if (friend.Relationship == EFriendRelationship.RequestRecipient)
             {
                 //Adds a friend based on their SteamID, because that is how steam friending works
                 steamFriends.AddFriend(friend.SteamID);
                 //Sleep half a second, not necessary but is nice.
                 Thread.Sleep(500);
                 //Notify the user that you are now friends to a bot.
                 steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg, "Ahoy friendo!");
             }
             if (friend.Relationship == EFriendRelationship.Friend)
             {
                 ids.Add(friend.SteamID);
                 ++count;
             }
         }
         string rand   = rLine [rnd.Next(rLine.Count)];
         SteamID newid = ids.ElementAt(who.Next(ids.Count));
         Console.WriteLine(steamFriends.GetFriendPersonaName(newid));
         Console.WriteLine(steamFriends.GetFriendPersonaState(newid));
         Console.WriteLine(DateTime.Now);
         if (steamFriends.GetFriendPersonaState(newid) == EPersonaState.Online || steamFriends.GetFriendPersonaState(newid) == EPersonaState.Away)
         {
             Console.WriteLine(rand);
             steamFriends.SendChatMessage(newid, EChatEntryType.ChatMsg, rand);                      //if so, respond with the response listed in chat.txt
         }
     }, null, 0, 1 * 60 * 1000);
 }
Exemple #12
0
 private static void OnFriendList(SteamFriends.FriendsListCallback obj)
 {
     Thread.Sleep(2500);
     foreach (var friend in obj.FriendList)
     {
         if (friend.Relationship == EFriendRelationship.RequestRecipient)
         {
             Console.Write("\t\tFriend added ");
             Console.ForegroundColor = ConsoleColor.Blue;
             Console.WriteLine(_steamFriends.GetFriendPersonaName(friend.SteamID));
             Console.ResetColor();
             _steamFriends.AddFriend(friend.SteamID);
             Thread.Sleep(1000);
             _steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg,
                                           "Hi. I am a HourBoosting , Reporting and commending Bot. Please un-friend me when u are done. You can use !help for help.");
         }
     }
 }
Exemple #13
0
 private static void OnFriendsList(SteamFriends.FriendsListCallback obj)
 {
     foreach (var friend in obj.FriendList)
     {
         if (friend.Relationship == EFriendRelationship.Friend)
         {
             if (!listFriendsSteamID.Contains(friend.SteamID))
             {
                 listFriendsSteamID.Add(friend.SteamID);
             }
         }
         if (friend.Relationship == EFriendRelationship.RequestRecipient)
         {
             steamFriends.AddFriend(friend.SteamID);
             steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg, "Olá você pode ver meus comandos digitando @help");
         }
     }
 }
Exemple #14
0
        static void OnFriendsList(SteamFriends.FriendsListCallback obj)
        {
            //LoadFriends();

            List <SteamID> newFriends = new List <SteamID>();

            foreach (SteamFriends.FriendsListCallback.Friend friend in obj.FriendList)
            {
                switch (friend.SteamID.AccountType)
                {
                // case EAccountType.Clan:
                //     if (friend.Relationship == EFriendRelationship.RequestRecipient)
                //    break;

                default:
                    CreateFriendsListIfNecessary();

                    if (friend.Relationship == EFriendRelationship.None)
                    {
                        steamFriends.RemoveFriend(friend.SteamID);
                    }
                    else if (friend.Relationship == EFriendRelationship.RequestRecipient)
                    {
                        if (!Friends.Contains(friend.SteamID))
                        {
                            Friends.Add(friend.SteamID);
                            newFriends.Add(friend.SteamID);
                        }
                    }
                    else if (friend.Relationship == EFriendRelationship.RequestInitiator)
                    {
                        if (!Friends.Contains(friend.SteamID))
                        {
                            Friends.Add(friend.SteamID);
                            newFriends.Add(friend.SteamID);
                        }
                    }
                    break;
                }
            }
            Console.WriteLine("[" + Program.BOTNAME + "] Recorded steam friends : {0}", steamFriends.GetFriendCount());
        }
        // When the friends list gets updated we need to do things such as add the person back.
        private void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            // at this point, the client has receivedh it's friends list

            int friendCount = steamFriends.GetFriendCount();

            for (int x = 0; x < friendCount; x++)
            {
                // Cycle through the friends list, if there's anybody we don't know we're going to keep a tab on him
                SteamID steamIdFriend = steamFriends.GetFriendByIndex(x);
                if (!Program.friends.ContainsKey(steamIdFriend))
                {
                    Program.friends.Add(steamIdFriend, new Chatter(steamIdFriend, this, Program.GetOldChannel(steamIdFriend.ToString())));
                }
            }

            // we can also iterate over our friendslist to accept or decline any pending invites

            foreach (var friend in callback.FriendList)
            {
                try {
                    if (friend.Relationship == EFriendRelationship.Friend)
                    {
                        Program.friends[friend.SteamID].addedToList = true;
                    }
                    else if (friend.Relationship == EFriendRelationship.RequestRecipient)
                    {
                        if (Program.friends[friend.SteamID].addedToList)
                        {
                            steamFriends.IgnoreFriend(friend.SteamID);
                        }
                        else
                        {
                            // this user has added us, let's add him back
                            steamFriends.AddFriend(friend.SteamID);
                            Program.friends[friend.SteamID].addedToList = true;
                        }
                    }
                } catch (System.Collections.Generic.KeyNotFoundException) {
                }
            }
        }
        internal async void OnFriendList(SteamFriends.FriendsListCallback callback)
        {
            if (!callback.FriendList.Any())
            {
                return;
            }
            foreach (var friend in callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    steamFriends.AddFriend(friend.SteamID);
                    Log(steamFriends.GetFriendPersonaName(friend.SteamID) + " was added to friends list", LogType.Info);
                }

                /*
                 * if (friend.SteamID.IsIndividualAccount) // Friend list
                 *  FriendList.Add(friend.SteamID);
                 */
            }
        }
Exemple #17
0
        } // Alle commands befinden sich hier. Kann auch noch anderer stuff geadded werden

        static void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            var friendCount = steamFriends.GetFriendCount();

            Thread.Sleep(TimeSpan.FromSeconds(5));

            if (steamFriends.GetPersonaState() == EPersonaState.Online)
            {
                for (int i = 0; i < steamFriends.GetFriendCount(); i++)
                {
                    SteamID friend = steamFriends.GetFriendByIndex(i);
                    if (steamFriends.GetFriendPersonaState(friend) != EPersonaState.Online)
                    {
                        continue;
                    }
                    Console.WriteLine("(FRIENDS) Friend: " + steamFriends.GetFriendPersonaName(friend) + " State: " + steamFriends.GetFriendPersonaState(friend), Color.Violet);
                }
            }

            Console.WriteLine($"(FRIENDS) You have {friendCount} friends on this account.\n", Color.Violet);
        } // Wird gecalled wenn Steam durch die Freundesliste crawled.
Exemple #18
0
        static void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            int friendCount = steamFriends.GetFriendCount();

            Console.WriteLine($"[SteamBot] Bot has {0} friends", friendCount);

            for (int x = 0; x < friendCount; x++)
            {
                SteamID steamIdFriend = steamFriends.GetFriendByIndex(x);

                Console.WriteLine($"[SteamBot] Friend: {0}", steamIdFriend.Render());
            }


            foreach (var friend in callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient)
                {
                    steamFriends.AddFriend(friend.SteamID);
                }
            }
        }
Exemple #19
0
        private void OnFriendList(SteamFriends.FriendsListCallback obj)
        {
            // sometimes the info hasn't been cached yet, so we must wait for that
            while (friends.GetFriendPersonaName(obj.FriendList[0].SteamID) == null)
            {
            }

            Console.BackgroundColor = ConsoleColor.Cyan;
            Console.ForegroundColor = ConsoleColor.Black;
            Debug.WriteLine($"You have {obj.FriendList.Count} friends!");
            Console.ResetColor();
            Debug.WriteLine("Press any key to list them.");
            Console.ReadKey();
            foreach (var friend in obj.FriendList)
            {
                string name = friends.GetFriendPersonaName(friend.SteamID);
                if (name == null)
                {
                    name = friend.SteamID.Render();
                }
                Debug.WriteLine($"{name} ({friends.GetFriendPersonaState(friend.SteamID)})");
            }
        }
Exemple #20
0
        /// <summary>
        /// Callback will be called if our friendslist is successfully loaded
        /// Set our state to online and change our name to the name inside the config
        ///
        /// Check if we have any friendrequests, if we have some, accept and invite the user to our group or decline them
        /// </summary>
        /// <param name="_callback"></param>
        private async void OnLoadedFriendsList(SteamFriends.FriendsListCallback _callback)
        {
            await m_steamFriends.SetPersonaState(EPersonaState.Online);

            if (!string.IsNullOrEmpty(m_botName))
            {
                await m_steamFriends.SetPersonaName(m_botName);
            }

            foreach (SteamFriends.FriendsListCallback.Friend friend in _callback.FriendList)
            {
                if (friend.Relationship == EFriendRelationship.RequestRecipient && friend.SteamID.IsIndividualAccount)
                {
                    if (m_acceptFriendRequests)
                    {
                        await m_steamFriendsHelper.AcceptFriendRequestAndInviteToGroup(m_steamFriends, friend.SteamID, m_steamUserWebAPI, m_adminGroupToInviteTo).ConfigureAwait(false);
                    }
                    else
                    {
                        m_steamFriendsHelper.DeclineFriendRequest(m_steamFriends, friend.SteamID);
                    }
                }
            }
        }
        void OnFriendsList(SteamFriends.FriendsListCallback callback)
        {
            // at this point, the client has received it's friends list

            int friendCount = _steamFriends.GetFriendCount();

            Console.WriteLine("We have {0} friends", friendCount);

            for (int x = 0; x < friendCount; x++)
            {
                // steamids identify objects that exist on the steam network, such as friends, as an example
                SteamID steamIdFriend = _steamFriends.GetFriendByIndex(x);
                // we'll just display the STEAM_ rendered version
                Console.WriteLine("Friend: {0}", steamIdFriend.Render());

                if (_cmd == Command.SendAll)
                {
                    _steamFriends.SendChatMessage(steamIdFriend, EChatEntryType.ChatMsg, _messageText);
                    Thread.Sleep(500);
                }
                else if (_cmd == Command.SendSingle)
                {
                    if (_userId == steamIdFriend.ConvertToUInt64().ToString())
                    {
                        _steamFriends.SendChatMessage(steamIdFriend, EChatEntryType.ChatMsg, _messageText);
                        _isMessageSent = true;
                        break;
                    }
                }
                else if (_cmd == Command.AcceptFriends)
                {
                    foreach (var friend in callback.FriendList)
                    {
                        if (friend.Relationship == EFriendRelationship.RequestRecipient)
                        {
                            // this _user has added us, let's add him back and send him a message
                            _steamFriends.AddFriend(friend.SteamID);
                            _steamFriends.SendChatMessage(friend.SteamID, EChatEntryType.ChatMsg, _messageText);
                            _isMessageSent = true;
                        }
                    }
                }
                else if (_cmd == Command.GetAllIds)
                {
                    foreach (var friend in callback.FriendList)
                    {
                        if (!_friendsIds.ContainsKey(friend.SteamID.ConvertToUInt64().ToString()))
                        {
                            var val = _steamFriends.RequestProfileInfo(friend.SteamID).ToTask().Result;
                            _friendsIds[friend.SteamID.ConvertToUInt64().ToString()] = val.RealName;
                        }
                    }
                    _isMessageSent = true;
                }
                else if (_cmd == Command.GetFriendInfo)
                {
                    if (_userId == steamIdFriend.ConvertToUInt64().ToString())
                    {
                        var val = _steamFriends.RequestProfileInfo(steamIdFriend).ToTask().Result;
                        _friendInfoVm.country    = val.CountryName;
                        _friendInfoVm.summary    = val.Summary;
                        _friendInfoVm.realName   = val.RealName;
                        _friendInfoVm.headline   = val.Headline;
                        _friendInfoVm.state      = val.StateName;
                        _friendInfoVm.steamId    = steamIdFriend.ToString();
                        _friendInfoVm.profileUrl = "https://steamcommunity.com/profiles/" + steamIdFriend.ConvertToUInt64().ToString();
                        string html;
                        using (WebClient client = new WebClient())
                        {
                            client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.121 Safari/535.2";
                            html = client.DownloadString("https://steamid.xyz/" + val.SteamID.ConvertToUInt64().ToString());
                        }
                        _friendInfoVm.image_url = GetImagesInHTMLString(html);
                        _isMessageSent          = true;
                    }
                }
            }
            if (_cmd == Command.SendAll)
            {
                _isMessageSent = true;
            }
        }