Ejemplo n.º 1
0
        private void OnLoggedOn(SteamUser.LoggedOnCallback callback)
        {
            if (callback.Result != EResult.OK)
            {
                // Just so guard and two factor can have the same name
                string code;

                switch (callback.Result)
                {
                // Steam Guard
                case EResult.AccountLogonDenied:
                    Console.Write("Steam Guard: ");
                    code = Console.ReadLine();
                    kraxbot.Login(code);
                    return;

                // Two factor
                case EResult.AccountLoginDeniedNeedTwoFactor:
                    Console.Write("Two factor: ");
                    code = Console.ReadLine();
                    kraxbot.Login(null, code);
                    return;

                // Other error
                default:
                    Kraxbot.Error($"Login failed: {callback.Result}");
                    return;
                }
            }

            // Log
            Kraxbot.Log("Logged in");

            // Save WebAPI stuff
            if (callback.Result == EResult.OK)
            {
                kraxbot.UserNonce = callback.WebAPIUserNonce;
            }

            // Login to Web
            kraxbot.LogOnToWeb();

            // Join chatrooms
            foreach (var chatroom in chatrooms)
            {
                joiningChatroom = chatroom;
                kraxbot.JoinChatRoom(chatroom);
            }
        }