25 lines
810 B
Python
25 lines
810 B
Python
# Accept/approve emoji set used across the bot.
|
|
# Works for both unicode and custom server emoji.
|
|
|
|
# Unicode emoji that should count as "accept"
|
|
ACCEPT_UNICODE = {"✅", "🫡", "❤️"}
|
|
|
|
# Custom emoji short names that should count as "accept"
|
|
# Add names (not the <:name:id> literal) for any server emoji you want.
|
|
ACCEPT_CUSTOM_NAMES = {"diverOK"}
|
|
|
|
def is_accept(emoji) -> bool:
|
|
"""
|
|
Return True if the given emoji should count as an 'accept' reaction.
|
|
Compatible with Reaction.emoji and RawReactionActionEvent.emoji.
|
|
"""
|
|
try:
|
|
# unicode path
|
|
if str(emoji) in ACCEPT_UNICODE:
|
|
return True
|
|
# custom emoji path (has a .name)
|
|
name = getattr(emoji, "name", None)
|
|
return name in ACCEPT_CUSTOM_NAMES
|
|
except Exception:
|
|
return False
|