canHandle method
Determines whether this builder can handle the given message
and
attachments
. If this returns true
, build will be called.
Otherwise, the next builder in the list will be called.
Implementation
@override
bool canHandle(
Message message,
Map<String, List<Attachment>> attachments,
) {
final images = attachments[AttachmentType.image];
if (images != null && images.length > 1) return true;
final videos = attachments[AttachmentType.video];
if (videos != null && videos.length > 1) return true;
final giphys = attachments[AttachmentType.giphy];
if (giphys != null && giphys.length > 1) return true;
if (images != null && videos != null) return true;
if (images != null && giphys != null) return true;
if (videos != null && giphys != null) return true;
return false;
}