reply method

Future<ModmailMessage> reply(
  1. String body, {
  2. bool authorHidden = false,
  3. bool internal = false,
})

Reply to the conversation.

body: the markdown formatted content of the reply. authorHidden: when true, the author is hidden from non-moderators. This is the same as replying as a subreddit. internal: when true, the reply will be an internal moderator note on the conversation that is not visible to non-moderators.

Returns a ModmailMessage for the new message.

Implementation

Future<ModmailMessage> reply(String body,
    {bool authorHidden = false, bool internal = false}) async {
  final data = <String, String>{
    'body': body,
    'isAuthorHidden': authorHidden.toString(),
    'isInternal': internal.toString(),
  };
  final response = await reddit.post(
      apiPath['modmail_conversation'].replaceAll(_kIdRegExp, id), data,
      objectify: false);
  final msgId = ((response['conversation']['objIds'] as List).last)['id'];
  final message = response['messages'][msgId];
  return ModmailMessage.parse(reddit, message);
}