protected override async Task <ISocialUser[]> GetMessageMentionedUsers(Comment comment) { Thing thing = await _client.GetThingByFullnameAsync(comment.ParentId).ConfigureAwait(false); string toUserName = ""; if (thing is Comment parentComment) { toUserName = parentComment.AuthorName; } else if (thing is Post parentPost) { toUserName = parentPost.AuthorName; } if (string.IsNullOrEmpty(toUserName)) { return(new ISocialUser[0]); } RedditUser toUser = await _client.GetUserAsync(toUserName).ConfigureAwait(false); return(new ISocialUser[] { new SocialUser(toUser.Name, toUser.Id) }); }
/// <summary> /// Gets the post with the specified id. /// </summary> /// <param name="id"></param> /// <returns></returns> public static async Task <Model> GetRedditPostAsync(string id) { try { return(new Model((RedditSharp.Things.Post) await _Reddit.GetThingByFullnameAsync($"t3_{id}").CAF())); } catch (ArgumentOutOfRangeException) //Returns this when a post was unable to be gotten { return(null); } }