mirror of
https://github.com/uhIgnacio/EmoteManager.git
synced 2024-08-15 02:23:13 +00:00
Merge pull request #4 from StarrFox/add-status-command
add status command
This commit is contained in:
commit
2c8913a1c9
1 changed files with 27 additions and 1 deletions
|
@ -83,7 +83,7 @@ class Emotes(commands.Cog):
|
||||||
if not context.guild or not isinstance(context.author, discord.Member):
|
if not context.guild or not isinstance(context.author, discord.Member):
|
||||||
raise commands.NoPrivateMessage
|
raise commands.NoPrivateMessage
|
||||||
|
|
||||||
if context.command is self.list:
|
if context.command is self.list or context.command is self.status:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -406,6 +406,32 @@ class Emotes(commands.Cog):
|
||||||
self.paginators.add(paginator)
|
self.paginators.add(paginator)
|
||||||
await paginator.begin()
|
await paginator.begin()
|
||||||
|
|
||||||
|
@commands.command()
|
||||||
|
async def status(self, context):
|
||||||
|
"""See Current status of emotes on this server.
|
||||||
|
"""
|
||||||
|
emote_limit = context.guild.emoji_limit
|
||||||
|
|
||||||
|
static_emotes = animated_emotes = total_emotes = 0
|
||||||
|
for emote in context.guild.emojis:
|
||||||
|
if emote.animated:
|
||||||
|
animated_emotes += 1
|
||||||
|
else:
|
||||||
|
static_emotes += 1
|
||||||
|
|
||||||
|
total_emotes += 1
|
||||||
|
|
||||||
|
percent_static = round((static_emotes / emote_limit) * 100, 2)
|
||||||
|
percent_animated = round((animated_emotes / emote_limit) * 100, 2)
|
||||||
|
|
||||||
|
static_left = emote_limit - static_emotes
|
||||||
|
animated_left = emote_limit - animated_emotes
|
||||||
|
|
||||||
|
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):
|
async def parse_emote(self, context, name_or_emote):
|
||||||
match = utils.emote.RE_CUSTOM_EMOTE.match(name_or_emote)
|
match = utils.emote.RE_CUSTOM_EMOTE.match(name_or_emote)
|
||||||
if match:
|
if match:
|
||||||
|
|
Loading…
Reference in a new issue