Closed waylaidwanderer closed 11 years ago
So instead of
Configuration config = Configuration.LoadConfiguration("settings.json");
foreach (Configuration.BotInfo info in config.Bots)
{
// etc etc
}
I want to just hard code the info into the program. I'd only be running one bot.
//Configuration config = Configuration.LoadConfiguration("settings.json");
//Log mainLog = new Log(config.MainLog, null);
//foreach (Configuration.BotInfo info in config.Bots)
// {
Configuration.BotInfo info = new Configuration.BotInfo();
info.password = "lolololol"
//Just hardcode the config info here.
mainLog.Info("Launching Bot " + info.DisplayName + "...");
new Thread(() =>
{
int crashes = 0;
while (crashes < 1000)
{
try
{
new Bot(info, config.ApiKey, (Bot bot, SteamID sid) =>
{
return (SteamBot.UserHandler)System.Activator.CreateInstance(Type.GetType(info.BotControlClass), new object[] { bot, sid });
},iItemDatabase, true);
}
catch (Exception e)
{
mainLog.Error("Error With Bot: " + e);
crashes++;
}
}
}).Start();
Thread.Sleep(5000);
//}
This should work. Commented out lines you wouldn't need.
You see where you wrote //Just hardcode the config info here.
? That's kinda what my issue is about - this is the part I don't know...
Otherwise I wouldn't be opening this issue :P
...Okay. Here's an example: Configuration config = new Configuration(); Configuration.BotInfo info = new Configuration.BotInfo(); config.ApiKey = "APIKEY"; config.MainLog = "syslog.log"; config.Admins = ulong[] uAdmins = {80830303003003003,4808401840814080}; info.Username = "USERNAME"; info.Password = "PASSWORD"; info.DisplayName = "DISPLAYNAME"; info.ChatResponse = "HI"; info.LogFile = "TestBot.log"; info.BotControlClass = "SteamBot.UserHandler";//Check ur actual config for this info.MaximumTradeTime = 180; info.MaximumActionGap = 30; info.DisplayNamePrefix = "[AUTOMATED BOT] "; info.TradePollingInterval = 800; info.LogLevel = "Success";
From: waylaidwanderer notifications@github.com To: Jessecar96/SteamBot SteamBot@noreply.github.com Cc: gamemaster1494 gamemaster1494@yahoo.com Sent: Monday, January 28, 2013 1:24 AM Subject: Re: [SteamBot] Launch bot without settings.json (#152)
You see where you wrote //Just hardcode the config info here.? That's kinda what my issue is about - this is the part I don't know... — Reply to this email directly or view it on GitHub.
Thanks gamemaster, that worked rather well.
And FunkyLoveCow, the reason I am doing this is to allow logging in and logging out into a different account on-the-fly, so I'm populating the config with blank settings on initialization.
You do realize that you can have multiple bots on one config file right? It runs them all at once.
Yep. I know what I'm doing - I wrote the KeyUserHandler you're using ;)
You can just make it not run all the bots at startup, and then tell it to load a different index "on the fly." So you can still have the json file.
I'd like to be able to launch SteamBot without a settings.json file, preferably by hardcoding the settings into the program itself (probably in Program.cs).
Can anyone show me how to do this?