public static void Main(object _BotStuff) { Botstuff = (OnyLib.BotStuff)_BotStuff; unprivSteamToys = new SteamToys(Botstuff); addfunctions(); Botstuff.OnyEvents.InComingMessage += new BotStuff.BotEvents.IncomingMessageHook(OnyEvents_InComingMessage); Botstuff.OnyVariables.logger.log("Hello from SteamInteraction!", Logging.Priority.Notice); }
public static void Main(object _BotStuff) { Botstuff = (OnyLib.BotStuff)_BotStuff; unprivSteamToys = new SteamToys(Botstuff); addfunctions(); Botstuff.OnyEvents.InComingMessage += new BotStuff.BotEvents.IncomingMessageHook(OnyEvents_InComingMessage); Botstuff.OnyVariables.logger.log("Hello from SteamInteraction!", Logging.Priority.Notice); sclient = new SteamKit2.SteamClient(System.Net.Sockets.ProtocolType.Tcp); SteamKit2.SteamFriends steamFriends = sclient.GetHandler<SteamKit2.SteamFriends>(); SteamKit2.SteamUser sUser = sclient.GetHandler<SteamKit2.SteamUser>(); sclient.Connect(); sUser.LogOn(new SteamKit2.SteamUser.LogOnDetails() { Username = "******", Password = "******" }); steamFriends.SendChatMessage(new SteamKit2.SteamID("STEAM_0:1:16516144"), SteamKit2.EChatEntryType.ChatMsg, "Hai dar"); }
static void Main(string[] args) { bstuff = new BotStuff(); Donify = bstuff.OnyVariables.Donify; logger = bstuff.OnyVariables.logger; nstruct = bstuff.OnyVariables.nstruct; if (!File.Exists("funcpersistence.xml")) { bstuff.OnyVariables.persistence.save(); } bstuff.OnyVariables.persistence.load(); LoadPlugins(); bstuff.OnyEvents.InComingMessage += new BotStuff.BotEvents.IncomingMessageHook(OnyEvents_InComingMessage); if (!socketfunctions.trybindsocket(mainsock, ref port, true, 50, IPAddress.Any)) { logger.log("FAILED TO BIND TO ANY PORT. EXITTING", Logging.Priority.Critical); return; } logger.log("Initialized main function", Logging.Priority.Info); logger.log("Loading variables..", Logging.Priority.Notice); try { bstuff.OnyFunctions.PrivFunctions.loadnow(new OnyLib.SpecialClasses.BotFunctionData(nstruct)); } catch (Exception ex) { logger.logerror(ex); } logger.log("Trying to load playback file..", Logging.Priority.Notice); try { nstruct.loadplayback(); } catch (Exception ex) { logger.logerror(ex); } while (bstuff.OnyVariables.run) { if ((bstuff.OnyVariables.amountloops % 10) == 0) { nstruct.saveplayback(); bstuff.OnyVariables.amountloops = 0; bstuff.OnyVariables.persistence.save(); } logger.log("Waiting for incoming commands", Logging.Priority.Info); Donify.Reset(); mainsock.BeginAccept(new AsyncCallback(acceptIncomingConnection), mainsock); Donify.WaitOne(); } nstruct.saveplayback(); bstuff.OnyVariables.persistence.save(); Console.WriteLine("Going down!"); logger.log("Shutting down bot.", Logging.Priority.Notice); logger.log("Uptime: " + (DateTime.Now - bstuff.OnyVariables.starttime).ToString(), Logging.Priority.Info); Environment.Exit(0); }
public static void Main(object _BotStuff) { Botstuff = (OnyLib.BotStuff)_BotStuff; unprivSteamToys = new SteamToys(Botstuff); addfunctions(); Botstuff.OnyEvents.InComingMessage += new BotStuff.BotEvents.IncomingMessageHook(OnyEvents_InComingMessage); Botstuff.OnyVariables.logger.log("Hello from SteamInteraction!", Logging.Priority.Notice); sclient = new SteamKit2.SteamClient(System.Net.Sockets.ProtocolType.Tcp); SteamKit2.SteamFriends steamFriends = sclient.GetHandler <SteamKit2.SteamFriends>(); SteamKit2.SteamUser sUser = sclient.GetHandler <SteamKit2.SteamUser>(); sclient.Connect(); sUser.LogOn(new SteamKit2.SteamUser.LogOnDetails() { Username = "******", Password = "******" }); steamFriends.SendChatMessage(new SteamKit2.SteamID("STEAM_0:1:16516144"), SteamKit2.EChatEntryType.ChatMsg, "Hai dar"); }
static void Main(string[] args) { bstuff = new BotStuff(); Donify = bstuff.OnyVariables.Donify; logger = bstuff.OnyVariables.logger; nstruct = bstuff.OnyVariables.nstruct; if (!File.Exists("funcpersistence.xml")) bstuff.OnyVariables.persistence.save(); bstuff.OnyVariables.persistence.load(); LoadPlugins(); bstuff.OnyEvents.InComingMessage += new BotStuff.BotEvents.IncomingMessageHook(OnyEvents_InComingMessage); if (!socketfunctions.trybindsocket(mainsock, ref port, true, 50, IPAddress.Any)) { logger.log("FAILED TO BIND TO ANY PORT. EXITTING", Logging.Priority.Critical); return; } logger.log("Initialized main function", Logging.Priority.Info); logger.log("Loading variables..",Logging.Priority.Notice); try { bstuff.OnyFunctions.PrivFunctions.loadnow(new OnyLib.SpecialClasses.BotFunctionData(nstruct)); } catch (Exception ex) { logger.logerror(ex); } logger.log("Trying to load playback file..", Logging.Priority.Notice); try { nstruct.loadplayback(); } catch (Exception ex) { logger.logerror(ex); } while (bstuff.OnyVariables.run) { if ((bstuff.OnyVariables.amountloops % 10) == 0) { nstruct.saveplayback(); bstuff.OnyVariables.amountloops = 0; bstuff.OnyVariables.persistence.save(); } logger.log("Waiting for incoming commands", Logging.Priority.Info); Donify.Reset(); mainsock.BeginAccept(new AsyncCallback(acceptIncomingConnection), mainsock); Donify.WaitOne(); } nstruct.saveplayback(); bstuff.OnyVariables.persistence.save(); Console.WriteLine("Going down!"); logger.log("Shutting down bot.", Logging.Priority.Notice); logger.log("Uptime: " + (DateTime.Now - bstuff.OnyVariables.starttime).ToString(), Logging.Priority.Info); Environment.Exit(0); }