reply method

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

Responds to this by an Message

Example :

await interaction.reply(content: 'Hello ${interaction.user.username}');

Implementation

Future<Interaction> reply ({ String? content, List<EmbedBuilder>? embeds, List<RowBuilder>? components, bool? tts, bool? private }) async {
  List<dynamic> embedList = [];
  if (embeds != null) {
    for (EmbedBuilder element in embeds) {
      embedList.add(element.toJson());
    }
  }

  List<dynamic> componentList = [];
  if (components != null) {
    for (RowBuilder element in components) {
      componentList.add(element.toJson());
    }
  }

  await ioc.use<HttpService>().post(url: "/interactions/$id/$token/callback", payload: {
    'type': InteractionCallbackType.channelMessageWithSource.value,
    'data': {
      'tts': tts ?? false,
      'content': content,
      'embeds': embeds != null ? embeds.map((e) => e.toJson()).toList() : [],
      'components': components != null ? components.map((e) => e.toJson()).toList() : [],
      'flags': private != null && private == true ? 1 << 6 : null,
    }
  });

  return this;
}