Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using SteamKit2;
- namespace KattBot
- {
- class Program
- {
- public static string Password { get; set; }
- public static string Username { get; set; }
- static string user, pass;
- static SteamClient steamClient;
- static CallbackManager manager;
- static SteamUser steamUser;
- static bool isRunning = false;
- static void Main(string[] args)
- {
- Console.Title = "A Bot";
- Console.WriteLine("Ctrl+C to Quit");
- Console.Write("Username: ");
- user = Console.ReadLine();
- Console.Write("Password: ");
- pass = Console.ReadLine();
- SteamLogIn();
- }
- static void SteamLogIn()
- {
- steamClient = new SteamClient();
- manager = new CallbackManager(steamClient);
- steamUser = steamClient.GetHandler<SteamUser>();
- new Callback<SteamClient.ConnectedCallback>(OnConnected, manager);
- new Callback<SteamUser.LoggedOnCallback>(OnLoggedOn, manager);
- steamClient.Connect();
- isRunning = true;
- while (isRunning)
- {
- manager.RunWaitCallbacks(TimeSpan.FromSeconds(1));
- }
- Console.ReadKey();
- }
- static void OnConnected(SteamClient.ConnectedCallback callback)
- {
- if(callback.Result != EResult.OK)
- {
- Console.WriteLine = ("Unable to connect to Steam: {0}", callback.Result);
- isRunning = false;
- return;
- }
- Console.WriteLine("Connected to Steam. \nLogging in{0}...\n",user);
- steamUser.LogOn(new SteamUser.LogOnDetails());
- {
- Username = user;
- Password = pass;
- }
- }
- static void OnLoggedOn(SteamUser.LoggedOnCallback callback)
- {
- if (callback.Result == EResult.AccountLogonDenied)
- {
- Console.WriteLine("This Account is SteamGuard Protected.");
- isRunning = false;
- return;
- }
- if (callback.Result != EResult.OK)
- {
- Console.WriteLine("Unable to log in to Steam: {0}\n", callback.Result);
- isRunning = false;
- return;
- }
- Console.WriteLine("{0} succesfully logged in!", user);
- Console.ReadKey();
- Environment.Exit(0);
- }
- }
- }
Add Comment
Please, Sign In to add comment