Skip to content
This repository was archived by the owner on Nov 8, 2017. It is now read-only.

Added mute user function #238

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions RedditSharp/Things/Subreddit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Subreddit : Thing
private const string AcceptModeratorInviteUrl = "/api/accept_moderator_invite";
private const string LeaveModerationUrl = "/api/unfriend";
private const string BanUserUrl = "/api/friend";
private const string MuteUserUrl = "/api/friend";
private const string AddModeratorUrl = "/api/friend";
private const string AddContributorUrl = "/api/friend";
private const string ModeratorsUrl = "/r/{0}/about/moderators.json";
Expand Down Expand Up @@ -598,6 +599,25 @@ public void BanUser(string user, string reason)
var response = request.GetResponse();
var result = WebAgent.GetResponseString(response.GetResponseStream());
}

public void MuteUser(string user, string reason)
{
var request = WebAgent.CreatePost(MuteUserUrl);
WebAgent.WritePostBody(request.GetRequestStream(), new
{
api_type = "json",
uh = Reddit.User.Modhash,
r = Name,
type = "muted",
id = "#muted",
name = user,
note = reason,
action = "add",
container = FullName
});
var response = request.GetResponse();
var result = WebAgent.GetResponseString(response.GetResponseStream());
}

private Post Submit(SubmitData data)
{
Expand Down