build method

  1. @override
Map<String, Object?> build()
override

Implementation

@override
Map<String, Object?> build() => {
      if (content != null) 'content': content,
      if (nonce != null) 'nonce': nonce,
      if (tts != null) 'tts': tts,
      if (embeds != null) 'embeds': embeds!.map((e) => e.build()).toList(),
      if (allowedMentions != null) 'allowed_mentions': allowedMentions!.build(),
      if (replyId != null)
        'message_reference': {
          'message_id': replyId.toString(),
          if (requireReplyToExist != null) 'fail_if_not_exists': requireReplyToExist,
        },
      if (components != null) 'components': components!.map((e) => e.build()).toList(),
      if (stickerIds != null) 'sticker_ids': stickerIds!.map((e) => e.toString()).toList(),
      if (attachments != null) 'attachments': attachments!.map((e) => e.build()).toList(),
      if (suppressEmbeds != null || suppressNotifications != null)
        'flags':
            (suppressEmbeds == true ? MessageFlags.suppressEmbeds.value : 0) | (suppressNotifications == true ? MessageFlags.suppressNotifications.value : 0),
      if (enforceNonce != null) 'enforce_nonce': enforceNonce,
    };