mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2025-07-04 12:15:24 +02:00
Implement reactions
This commit is contained in:
@ -36,6 +36,8 @@ def get_formatted_message(message):
|
||||
member = message.guild.get_member(mention["id"])
|
||||
if member:
|
||||
mention["nickname"] = member.nick
|
||||
if hasattr(message, "reactions"):
|
||||
msg["reactions"] = get_message_reactions(message.reactions)
|
||||
return msg
|
||||
|
||||
def get_formatted_user(user):
|
||||
@ -246,4 +248,26 @@ def get_embeds_list(embeds):
|
||||
em = []
|
||||
for e in embeds:
|
||||
em.append(e.to_dict())
|
||||
return em
|
||||
return em
|
||||
|
||||
def get_message_reactions(reactions):
|
||||
reacts = []
|
||||
for reaction in reactions:
|
||||
reacts.append({
|
||||
"emoji": get_partial_emoji(reaction.emoji),
|
||||
"count": reaction.count
|
||||
})
|
||||
return reacts
|
||||
|
||||
def get_partial_emoji(emoji):
|
||||
emote = {
|
||||
"animated": False,
|
||||
"id": None,
|
||||
"name": str(emoji)
|
||||
}
|
||||
if isinstance(emoji, str):
|
||||
return emote
|
||||
emote["animated"] = emoji.animated
|
||||
emote["id"] = str(emoji.id)
|
||||
emote["name"] = emoji.name
|
||||
return emote
|
Reference in New Issue
Block a user