Skip to content

Commit

Permalink
Make filename required in AttachmentBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything committed Sep 16, 2023
1 parent cca3200 commit cd24ab9
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 cd24ab9

Please sign in to comment.