edit method

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

Edit this message

await message.edit(content: 'Hello world!');

Implementation

Future<Message?> 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
    ? Message.from(channel: channel, payload: jsonDecode(response.body))
    : null;
}