Skip to content

Commit

Permalink
Add enforceNonce field to MessageBuilder (#631)
Browse files Browse the repository at this point in the history
* impl

* doc
  • Loading branch information
MCausc78 authored Feb 17, 2024
1 parent 4ece7f7 commit 7407767
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/src/builders/message/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ class MessageBuilder extends CreateBuilder<Message> {

bool? suppressNotifications;

/// If true and nonce is present, it will be checked for uniqueness in the past few minutes. If another message was created by the same author with the same nonce,
/// that message will be returned and no new message will be created.
bool? enforceNonce;

MessageBuilder({
this.content,
this.nonce,
Expand All @@ -45,6 +49,7 @@ class MessageBuilder extends CreateBuilder<Message> {
this.attachments,
this.suppressEmbeds,
this.suppressNotifications,
this.enforceNonce,
});

@override
Expand All @@ -65,6 +70,7 @@ class MessageBuilder extends CreateBuilder<Message> {
if (suppressEmbeds != null || suppressNotifications != null)
'flags':
(suppressEmbeds == true ? MessageFlags.suppressEmbeds.value : 0) | (suppressNotifications == true ? MessageFlags.suppressNotifications.value : 0),
if (enforceNonce != null) 'enforce_nonce': enforceNonce,
};
}

Expand Down

0 comments on commit 7407767

Please sign in to comment.