Skip to content

Instantly share code, notes, and snippets.

@Soheab
Last active April 7, 2023 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Soheab/892f9d950dd1f5da289144a09831c9c3 to your computer and use it in GitHub Desktop.
Save Soheab/892f9d950dd1f5da289144a09831c9c3 to your computer and use it in GitHub Desktop.
# for testing:
# import collections
# emoji = collections.namedtuple("emo", ["animated"])(False)
emoji = ... # some (Partial)Emoji object
guild = ... # some Guild object
emojis = guild.emojis
total = len(guild.emojis)
limit = guild.emoji_limit
animated = sum(1 for e in emojis if e.animated)
regular = sum(1 for e in emojis if not e.animated)
total_slots = limit*2 - total
animated_slots = limit - animated
regular_slots = limit - regular
print(f"{total_slots=}\n{animated_slots=}\n{regular_slots=}")
if not total_slots:
print("Not slots available!")
if emoji.animated and not animated_slots:
print("No slots available for animated emojis")
elif not emoji.animated and not regular_slots:
print("No slots available for regular emojis")
else:
what = f"{animated_slots} animated" if emoji.animated else f"{regular_slots} regular"
print(f"fine to add, {what} slots available")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment