Skip to content

Commit

Permalink
Make filename required in AttachmentBuilder (#546)
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything authored Sep 16, 2023
1 parent e2cd7b4 commit bfbe4e5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/builders/message/attachment.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import 'package:nyxx/src/models/message/attachment.dart';
class AttachmentBuilder extends Builder<Attachment> {
List<int> data;

String? fileName;
String fileName;

String? description;

AttachmentBuilder({required this.data, this.fileName, this.description});
AttachmentBuilder({required this.data, required this.fileName, this.description});

static Future<AttachmentBuilder> fromFile(File file, {String? description}) async {
final data = await file.readAsBytes();
Expand All @@ -26,7 +26,7 @@ class AttachmentBuilder extends Builder<Attachment> {

@override
Map<String, Object?> build() => {
if (fileName != null) 'filename': fileName,
'filename': fileName,
if (description != null) 'description': description,
};
}

0 comments on commit bfbe4e5

Please sign in to comment.