-
Notifications
You must be signed in to change notification settings - Fork 1
/
message_reactions.py
30 lines (21 loc) · 933 Bytes
/
message_reactions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import discord as discord
def most_reactions(reactions: [discord.Reaction]) -> [discord.Reaction]:
if len(reactions) == 1:
return reactions
largest_num = reactions[0].count
biggest = [reactions[0]]
for reaction in reactions[1:]:
if reaction.count == largest_num:
biggest.append(reaction)
elif reaction.count > largest_num:
biggest = [reaction]
largest_num = reaction.count
return biggest
async def reaction_count_without_author(message):
max_reaction_count = 0
for reaction in message.reactions:
react_count = reaction.count
users_ids = [user.id async for user in reaction.users()]
corrected_count = react_count-1 if message.author.id in users_ids else react_count
max_reaction_count = corrected_count if corrected_count > max_reaction_count else max_reaction_count
return max_reaction_count