Skip to content

Commit

Permalink
Added messages's threads
Browse files Browse the repository at this point in the history
  • Loading branch information
PandaGuerrier committed May 13, 2023
1 parent d6ccb4d commit 42b3ea1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/src/api/messages/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ class Message extends PartialMessage<TextBasedChannel> {
.build();
}

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

return ThreadChannel.fromPayload(jsonDecode(respose.body));
}

Future<void> pin (Snowflake webhookId) async {
if (isPinned) {
ioc.use<ConsoleService>().warn('Message $id is already pinned');
Expand Down

0 comments on commit 42b3ea1

Please sign in to comment.