edit method

Future<DmMessage?> edit({
  1. String? content,
  2. List<EmbedBuilder>? embeds,
  3. ComponentBuilder? components,
  4. List<AttachmentBuilder>? attachments,
  5. bool? tts,
})

Implementation

Future<DmMessage?> edit ({ String? content, List<EmbedBuilder>? embeds, ComponentBuilder? components, List<AttachmentBuilder>? attachments, bool? tts }) async {
  dynamic messagePayload = MessageParser(content, embeds, components, attachments, null).toJson();

  Response response = await ioc.use<DiscordApiHttpService>().patch(url: '/channels/${channel.id}/messages/$id')
      .files(messagePayload['files'])
      .payload({
    ...messagePayload['payload'],
    'flags': flags,
    'allowed_mentions': allowMentions
  })
      .build();

  return response.statusCode == 200
      ? DmMessage.from(channel: channel, payload: jsonDecode(response.body))
      : null;
}