File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -256,5 +256,38 @@ private async Task SetReadStatusAsync(string statusUrl)
256
256
api_type = "json"
257
257
} ) . ConfigureAwait ( false ) ;
258
258
}
259
+
260
+ #region Static Methods
261
+ /// <summary>
262
+ /// Post a reply to a specific comment
263
+ /// </summary>
264
+ /// <param name="webAgent"></param>
265
+ /// <param name="commentFullName">e.g. "t1_12345"</param>
266
+ /// <param name="message"></param>
267
+ /// <returns></returns>
268
+ public static async Task Reply ( IWebAgent webAgent , string commentFullName , string message ) {
269
+ // TODO actual error handling. This just hides the error and returns null
270
+ //try
271
+ //{
272
+ var json = await webAgent . Post ( CommentUrl , new {
273
+ text = message ,
274
+ thing_id = commentFullName ,
275
+ api_type = "json"
276
+ //r = Subreddit
277
+ } ) . ConfigureAwait ( false ) ;
278
+ if ( json [ "json" ] [ "ratelimit" ] != null ) {
279
+ throw new RateLimitException ( TimeSpan . FromSeconds ( json [ "json" ] [ "ratelimit" ] . ValueOrDefault < double > ( ) ) ) ;
280
+ }
281
+
282
+
283
+ //}
284
+ //catch (HttpRequestException ex)
285
+ //{
286
+ // var error = new StreamReader(ex..GetResponseStream()).ReadToEnd();
287
+ // return null;
288
+ //}
289
+ }
290
+ #endregion
291
+
259
292
}
260
293
}
You can’t perform that action at this time.
0 commit comments