public bool OnEnable(IRecognitionServer server) { this.server = server; steamClient = new SteamWebClient("Voice Recognition System", "irjgEfRGKftgj"); // Will setup a configuration system at some point. server.GetLogger().Info("Enabling Steam.dll Plugin"); server.GetLogger().Info("Pinging for Authorisation with Steam Client"); if (!steamClient.AuthoriseClient()) { server.GetLogger().Warn("Please authorise this system to control your Steam Client."); server.GetLogger().Info("Another attempt will be made in 10 seconds. If this fails, Steam.dll will not be loaded."); Thread.Sleep(10000); if (!steamClient.AuthoriseClient()) { server.GetLogger().Severe("Failed to authorise with Steam Client. Reload plugin to re-attempt."); return(false); } } commands.Add(new Commands.Game(this)); commands.Add(new Commands.Space(this)); return(true); }
public ItemsSchema(SteamWebClient webClient, string webAPIKey) { WebClient = webClient; Cache = new Dictionary<int, TF2Schema>(); TF2ItemIds = new SortedDictionary<int, TF2ItemSchema>(); TF2ItemClassIds = new SortedDictionary<int, TF2ItemSchema>(); TF2WebClient = new TF2WebClient(webAPIKey); }
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(); } }