send method

Future<Message?> send({
  1. String? content,
  2. List<EmbedBuilder>? embeds,
  3. ComponentBuilder? components,
  4. List<AttachmentBuilder>? attachments,
  5. 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, ComponentBuilder? components, List<AttachmentBuilder>? attachments, bool? tts }) async {
  MineralClient client = ioc.use<MineralClient>();

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

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

    return message;
  }

  return null;
}