private static async void OnWelcome(WelcomeEvent message) { // if reusing the token, user might be already logged in, so check that before requesting login if (message.LoggedInUser == null) { Config config = Config.Load(); await _client.LoginAsync(config.Username, config.Password, WolfLoginType.Email); } await _client.SubscribeAllMessagesAsync(); // without this, bot will not receive any messages }
private static async void OnWelcome(WelcomeEvent message) { // if reusing the token, user might be already logged in, so check that before requesting login if (message.LoggedInUser == null) { Config config = Config.Load(); await _client.LoginAsync(config.Username, config.Password, WolfLoginType.Email); } await _client.SubscribeAllMessagesAsync(); // without this, bot will not receive any messages // user should not be cached locally - always call GetUserAsync/GetCurrentUserAsync on client! WolfUser user = await _client.GetCurrentUserAsync(); // same applies to groups - always call GetGroupsAsync! IEnumerable <WolfGroup> groups = await _client.GetCurrentUserGroupsAsync(); }