edit method
Future<Message?>
edit({
- String? content,
- List<
EmbedBuilder> ? embeds, - ComponentBuilder? components,
- List<
AttachmentBuilder> ? attachments, - 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;
}