From add1b041a5e1e5ebdceaa328d4e24a3f98b15400 Mon Sep 17 00:00:00 2001 From: StarrFox <43019162+StarrFox@users.noreply.github.com> Date: Sun, 26 Apr 2020 23:27:21 -0500 Subject: [PATCH] Use guild.emoji_limit and implicit string concatenation --- cogs/emote.py | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/cogs/emote.py b/cogs/emote.py index e88a55a..0f06bf3 100644 --- a/cogs/emote.py +++ b/cogs/emote.py @@ -410,19 +410,7 @@ class Emotes(commands.Cog): async def status(self, context): """See Current status of emotes on this server. """ - premium_tier = context.guild.premium_tier - - if premium_tier == 1: - max_emotes = 200 - elif premium_tier == 2: - max_emotes = 300 - elif premium_tier == 3: - max_emotes = 500 - else: - max_emotes = 100 - - # number of emotes per category - per_cat = max_emotes // 2 + emote_limit = context.guild.emoji_limit static_emotes = animated_emotes = total_emotes = 0 for emote in context.guild.emojis: @@ -433,18 +421,16 @@ class Emotes(commands.Cog): total_emotes += 1 - percent_static = round((static_emotes / per_cat) * 100, 2) - percent_animated = round((animated_emotes / per_cat) * 100, 2) - static_left = per_cat - static_emotes - animated_left = per_cat - animated_emotes + percent_static = round((static_emotes / emote_limit) * 100, 2) + percent_animated = round((animated_emotes / emote_limit) * 100, 2) - message = [ - f'Static emotes: **{static_emotes} / {per_cat}** ({static_left} left, {percent_static}% full)', - f'Animated emotes: **{animated_emotes} / {per_cat}** ({animated_left} left, {percent_animated}% full)', - f'Total: **{total_emotes} / {max_emotes}**' - ] + static_left = emote_limit - static_emotes + animated_left = emote_limit - animated_emotes - await context.send('\n'.join(message)) + await context.send( + f'Static emotes: **{static_emotes} / {emote_limit}** ({static_left} left, {percent_static}% full)\n' + f'Animated emotes: **{animated_emotes} / {emote_limit}** ({animated_left} left, {percent_animated}% full)\n' + f'Total: **{total_emotes} / {emote_limit * 2}**') async def parse_emote(self, context, name_or_emote): match = utils.emote.RE_CUSTOM_EMOTE.match(name_or_emote)