send method

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

Sends a message on this.

final TextChannel channel = guild.channels.cache.getOrFail('240561194958716924');
await channel.send(content: 'Hello world ! 🔥');

Implementation

Future<Message?> send ({ String? content, List<EmbedBuilder>? embeds, List<RowBuilder>? components, bool? tts }) async {
  MineralClient client = ioc.singleton(Service.client);

  Response response = await client.sendMessage(this,
    content: content,
    embeds: embeds,
    components: components
  );

  if (response.statusCode == 200) {
    Message message = Message.from(channel: this, payload: jsonDecode(response.body));
    messages.cache.putIfAbsent(message.id, () => message);

    return message;
  }

  return null;
}