public static bool isVideoDocument(TLDocument document) { if (document != null) { bool isAnimated = false; bool isVideo = false; int width = 0; int height = 0; for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeVideo videoAttribute) { isVideo = true; width = videoAttribute.W; height = videoAttribute.H; } else if (attribute is TLDocumentAttributeAnimated) { isAnimated = true; } } if (isAnimated && (width > 1280 || height > 1280)) { isAnimated = false; } return(isVideo && !isAnimated); } return(false); }
public static bool isMusicDocument(TLDocument document) { if (document != null) { for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeAudio audioAttribute) { return(!audioAttribute.IsVoice); } } } return(false); }
public static bool isMaskDocument(TLDocument document) { if (document != null) { for (int a = 0; a < document.Attributes.Count; a++) { TLDocumentAttributeBase attribute = document.Attributes[a]; if (attribute is TLDocumentAttributeSticker stickerAttribute && stickerAttribute.IsMask) { return(true); } } } return(false); }