Handles steam user related tasks.
 public ChatWindow(ChatEventsManager chatEventsManager, SteamChatHandler chatHandler, SteamUserHandler steamUserHandler)
 {
     chatEventsManager.ChatMessageReceived += OnChatMessage;
     SteamUserHandler = steamUserHandler;
     ChatHandler = chatHandler;
     
     Loaded += ChatWindow_Loaded;
     InitializeComponent();
 }
        public FriendsListWindow(Account account, string apiKey)
        {
            _account = account;

            #region activate apis
            ChatHandler = new SteamChatHandler(_account);
            SteamUserHandler = new SteamUserHandler(apiKey);
            #endregion

            InitializeComponent();
        }
Example #3
0
        private static void Main()
        {
            Console.Title = "Chat Bot by sne4kyFox";
            Console.WriteLine("Welcome to the chat bot!");
            Console.WriteLine(
                "By using this software you agree to the terms in \"license.txt\".");

            LoadConfig();
            Login();

            SteamUserHandler = new SteamUserHandler(_config.ApiKey);

            //handles sending messages and such
            ChatHandler = new SteamChatHandler(_account);
            //allows you to use a built-in message loop without constructing your own. Non-blocking
            ChatEventsManager = new ChatEventsManager(ChatHandler);
            //non-blocking callback like in SteamKit2
            ChatEventsManager.ChatMessageReceived += OnChatMessage;
        }
 private SteamId ParseId()
 {
     try
     {
         SteamId id = null;
         if (IdBox.Text.StartsWith("STEAM_"))
         {
             id = new SteamId(IdBox.Text);
         }
         else
         {
             ulong tryParseUlong;
             if (ulong.TryParse(IdBox.Text, out tryParseUlong))
             {
                 id = new SteamId(tryParseUlong);
             }
             else
             {
                 string apiKey = GetInput(
                     "If you are trying to resolve a CustomURL, please enter in your API key. Please note this is not necessary for SteamID/SteamID64.",
                     "API key required!");
                 _userHandler = new SteamUserHandler(apiKey);
                 if (ulong.TryParse(_userHandler.ResolveVanityUrl(IdBox.Text).SteamId, out tryParseUlong))
                 {
                     id = new SteamId(tryParseUlong);
                 }
             }
         }
         return id;
     }
     catch (Exception)
     {
         MessageBox.Show("Invalid SteamId, please try using a valid SteamID, SteamID64, or CustomURL.");
         return null;
     }
 }