createThread method

Future<ThreadChannel?> createThread({
  1. required String label,
  2. int archiveDuration = 60,
})

Create a thread from this message

ThreadChannel? thread = await message.createThread(label: 'My thread');

Implementation

Future<ThreadChannel?> createThread ({ required String label, int archiveDuration = 60}) async {
   Response response = await ioc.use<DiscordApiHttpService>().post(url: '/channels/${super.channel.id}/messages/${super.id}/threads')
      .payload({
        'name': label,
        'auto_archive_duration': archiveDuration,
      })
      .build();

  return await channel.guild.channels.resolve(jsonDecode(response.body)['id']) as ThreadChannel?;
}