Pārlūkot izejas kodu

made emote backup to the old version of the command if it cant see the emoji.

tags/v1.7.0
Roxie Gibson pirms 6 gadiem
vecāks
revīzija
ddedaab2ee
2 mainītis faili ar 16 papildinājumiem un 7 dzēšanām
  1. +15
    -6
      roxbot/cogs/util.py
  2. +1
    -1
      roxbot/converters.py

+ 15
- 6
roxbot/cogs/util.py Parādīt failu

@@ -182,12 +182,21 @@ class Util():
;emote [emote]
"""
try:
em = discord.Embed(title=emote.name, colour=roxbot.EmbedColours.blue)
em.add_field(name="ID", value=str(emote.id), inline=False)
em.add_field(name="Guild", value=str(emote.guild), inline=False)
em.add_field(name="Created At", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(emote.created_at), inline=False)
em.set_image(url=emote.url)
return await ctx.send(embed=em)
if isinstance(emote, str):
emote = emote.strip("<>").split(":")
if emote[0] == "a":
emoji_id = emote[2]
else:
emoji_id = emote[2]
url = "https://cdn.discordapp.com/emojis/{}".format(emoji_id)
return await ctx.send(url)
else:
em = discord.Embed(title=emote.name, colour=roxbot.EmbedColours.blue)
em.add_field(name="ID", value=str(emote.id), inline=False)
em.add_field(name="Guild", value=str(emote.guild), inline=False)
em.add_field(name="Created At", value="{:%a %Y/%m/%d %H:%M:%S} UTC".format(emote.created_at), inline=False)
em.set_image(url=emote.url)
return await ctx.send(embed=em)
except IndexError:
return await ctx.send("This command only supports custom emojis at the moment. Sorry.")


+ 1
- 1
roxbot/converters.py Parādīt failu

@@ -33,6 +33,6 @@ class EmojiConverter(commands.EmojiConverter):
try:
return await super().convert(ctx, argument)
except:
raise commands.BadArgument("""Emoji "{}" not found/is unicode emoji. Unicode emoji isn't currently supported.""".format(argument))
return argument

# TODO: Make functions that work like converters but aren't so they actually work in other areas too.

Notiek ielāde…
Atcelt
Saglabāt