numberEmotes property
int
get
numberEmotes
Gets the number of emotes in a given message. This is useful to determine
if the emotes should be displayed bigger.
If the body contains a reply then it is stripped.
WARNING: This does not test if there are only emotes. Use event.onlyEmotes
for that!
Implementation
int get numberEmotes {
if (isRichMessage) {
final formattedTextStripped = formattedText.replaceAll(
RegExp('<mx-reply>.*</mx-reply>',
caseSensitive: false, multiLine: false, dotAll: true),
'');
return _countEmojiEmoteRegex.allMatches(formattedTextStripped).length;
} else {
return _countEmojiRegex.allMatches(plaintextBody).length;
}
}