reply method

Future<PartialMessage<PartialChannel>?> reply({
  1. String? content,
  2. List<EmbedBuilder>? embeds,
  3. List<RowBuilder>? components,
  4. bool? tts,
})

Implementation

Future<PartialMessage?> reply ({ String? content, List<EmbedBuilder>? embeds, List<RowBuilder>? components, bool? tts }) async {
  MineralClient client = ioc.use<MineralClient>();

  Response response = await client.sendMessage(channel,
    content: content,
    embeds: embeds,
    components: components,
    messageReference: {
      'guild_id': channel.guild.id,
      'channel_id': channel.id,
      'message_id': id,
    }
  );

  if (response.statusCode == 200) {
    Message message = Message.from(channel: channel, payload: jsonDecode(response.body));

    if (channel is CategoryChannel) {
      (channel as TextBasedChannel).messages.cache.putIfAbsent(message.id, () => message);
    }

    if (channel is PartialTextChannel) {
      (channel as PartialTextChannel).messages.cache.putIfAbsent(message.id, () => message);
    }

    return message;
  }

  return null;
}