internal Bot(Logger logger, ItemsSchema schema, BotCredentials credentials) { Logger = logger; IsRunning = true; Admins = new List <SteamID>(); ItemsSchema = schema; Credentials = credentials; CurrentTrade = null; PendingTradeRequest = null; PendingTrades = new Queue <TradeRequest>(); PendingTradeTimer = new Timer(new TimerCallback(HandlePendingTradeTimer), null, Timeout.Infinite, Timeout.Infinite); #if DATABASE ConnectDatabase(); #endif }
static void Main(string[] args) { var SteamWebClient = new SteamWebClient(); var bots = new BotCredentials[] { new BotCredentials() { Username = "******", Password = "******" } }; var schemaCache = new ItemsSchema(SteamWebClient, STEAM_WEB_KEY); var schemas = schemaCache.LookupSchemas(); schemaCache.Load(schemas); foreach (var botInfo in bots) { var bot = new Bot(Logger, schemaCache, botInfo); bot.Admins.Add(new SteamID(00000000000000000)); bot.OnWebLoggedOn += (b) => { b.SteamFriends.SetPersonaName("SteamBot"); b.SteamFriends.SetPersonaState(EPersonaState.Online); }; bot.Initialize(useUDP: true); bot.Connect(); while (bot.IsRunning) { bot.Update(); bot.UpdateIdlerBots(); Thread.Sleep(1); } Logger.WriteLine("Bot is shutting down"); bot.Shutdown(); } }
static void Main(string[] args) { var SteamWebClient = new SteamWebClient(); var bots = new BotCredentials[] { new BotCredentials() { Username = "******", Password = "******" } }; var schemaCache = new ItemsSchema(SteamWebClient, STEAM_WEB_KEY); var schemas = schemaCache.LookupSchemas(); schemaCache.Load(schemas); foreach(var botInfo in bots) { var bot = new Bot(Logger, schemaCache, botInfo); bot.Admins.Add(new SteamID(00000000000000000)); bot.OnWebLoggedOn += (b) => { b.SteamFriends.SetPersonaName("SteamBot"); b.SteamFriends.SetPersonaState(EPersonaState.Online); }; bot.Initialize(useUDP: true); bot.Connect(); while (bot.IsRunning) { bot.Update(); bot.UpdateIdlerBots(); Thread.Sleep(1); } Logger.WriteLine("Bot is shutting down"); bot.Shutdown(); } }