reply method

Future<void> 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<void> reply ({ String? content, List<EmbedBuilder>? embeds, List<RowBuilder>? components, bool? tts, bool? private }) async {
  Http http = ioc.singleton(Service.http);

  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 http.post(url: "/interactions/$id/$token/callback", payload: {
    'type': InteractionCallbackType.channelMessageWithSource.value,
    'data': {
      'tts': tts ?? false,
      'content': content,
      'embeds': embeds != null ? embedList : [],
      'components': components != null ? componentList : [],
      'flags': private != null && private == true ? 1 << 6 : null,
    }
  });
}