public async Task<SocialResponse<UserInfo>> SignIn() { SocialResponse<UserInfo> result = new SocialResponse<UserInfo>(); try { var facebookClient = new FacebookSessionClient(APP_ID); var session = await facebookClient.LoginAsync(); if (!string.IsNullOrEmpty(session.AccessToken)) { result.Result = true; settings.Set(FACEBOOK_TOKEN_SETTING, session.AccessToken); settings.Set(FACEBOOK_TOKEN_EXPIRES_AT_SETTING, session.Expires.ToFileTimeUtc()); var userInfo = await GetUserInfo(); await GetExtendedToken(); } Debug.WriteLine(session.AccessToken); Debug.WriteLine(session.FacebookId); Debug.WriteLine(session.Expires); } catch (Exception ex) { Debug.WriteLine(ex.Message); result.Result = false; } return result; }
public async Task <SocialResponse> SendFreeMessageAsync(string message, IReplyMarkup replyMarkup = null) { var response = new SocialResponse(); try { if (_isFreeActive) { var s = await _telegramFree.SendTextMessageAsync( _freeChatId, message, parseMode : ParseMode.Markdown, disableWebPagePreview : true, replyMarkup : replyMarkup); } response.Success = true; } catch (Exception e) { response.Success = false; response.Message = e.GetFullMessage(); } return(response); }
public async Task <SocialResponse> SendMessageAsync(string message) { var response = new SocialResponse(); try { if (IsActive) { var userClient = new TwitterClient(_apiKey, _apiSecret, _accessToken, _accessSecret); var tweet = await userClient.Tweets.PublishTweetAsync(message); } response.Success = true; } catch (Exception e) { response.Success = false; response.Message = e.GetFullMessage(); } return(response); }