public async Task PoststatusAsync(string status, Visibility visibility) { var response = await client.PostStatus(status, visibility); Logger.NLogInfo($"Post Toot on {Instance}."); Logger.NLogInfo($"Toot message is {status}."); }
public MastdonHelper(MastodonAuthSet mastdonAuthSet) { appRegistration = mastdonAuthSet.AppRegistration; Instance = appRegistration.Instance; acsessToken = mastdonAuthSet.AccessToken; Logger.NLogInfo($"Constructer OK on {Instance}."); }
private async Task <IEnumerable <Account> > GetFriends() { var friends = await client.GetAccountFollowing(CurrentUser.Id); Logger.NLogInfo($"Get Friends EnumrateList on {Instance}."); return(friends); }
public async Task <IEnumerable <Status> > GetMentionsTimeLineAsync() { var menstionsTileline = await client.GetNotifications(); Logger.NLogInfo($"GetMentionsTimeline on {Instance}."); return(menstionsTileline.Where(e => e.Type == "mention").Select(e => e.Status)); }
public async Task <IEnumerable <Status> > SearchTagTimeLineAsync(int _count, string keyword) { var tweets = await client.GetTagTimeline(keyword, false); Logger.NLogInfo($"Search keyword is {keyword} on {Instance}."); return(tweets); }
public async Task Initializer() { client = new MastodonClient(appRegistration, acsessToken); CurrentUser = await GetCurrentUser(); Followers = await GetFollowers(); Friends = await GetFriends(); Logger.NLogInfo($"Initializer OK on {Instance}."); }
public IEnumerable <Account> FollowBack() { foreach (var user in Followers) { if (Friends.FirstOrDefault(e => e.Id == user.Id) == null) { client.Follow(user.Id); Logger.NLogInfo($"FollowBack to {user.UserName} on {Instance}."); yield return(user); } } }
public async Task ReplyAsync(int tweetId, Visibility visibillity, string message) { try { await client.PostStatus(message, visibillity, (int)tweetId); Logger.NLogInfo($"Retoot is {tweetId},Visibillity is {visibillity.ToString()} on {Instance}."); } catch (System.Exception e) { Console.WriteLine($"MastodonHelperError!:{e.Message}"); } }
public async Task <IEnumerable <Account> > RemoveBack() { var users = new List <Account>(); var haveNotRemovedUsers = GetHaveNotRemovedUsers(); foreach (var user in haveNotRemovedUsers) { await client.Unfollow(user.Id); Logger.NLogInfo($"UnFollowBack to {user.UserName} on {Instance}."); users.Add(user); } return(users); }
public async Task ReToot(int id) { try { var result = await client.Reblog(id); } catch (Exception e) { Console.WriteLine(e.Message); return; throw; } Logger.NLogInfo($"Retoot is {id} on {Instance}."); }
public async Task FavouriteAsync(int id) { await client.Favourite(id); Logger.NLogInfo($"Fovourite is {id} on {Instance}."); }
private async Task <Account> GetCurrentUser() { Logger.NLogInfo($"GetCurrentUser on {Instance}."); return(await client.GetCurrentUser()); }
public async Task <IEnumerable <Status> > GetTimeLineAsync() { Logger.NLogInfo($"GetHomeTimeline on {Instance}."); return(await client.GetHomeTimeline()); }