getReactionCounts method

Map<String, int> getReactionCounts(
  1. String messageId
)

Returns a map of reaction counts for a given messageId.

Implementation

Map<String, int> getReactionCounts(String messageId) {
  final reactions = getReactions(messageId);
  final counts = <String, int>{};
  for (final reaction in reactions) {
    counts[reaction.emoji] = (counts[reaction.emoji] ?? 0) + 1;
  }
  return counts;
}