Browse Source

added more info to the emote command and added some more helpful errors with a new converter that I can add onto later to support unicode emoji.

tags/v1.7.0
Roxie Gibson 6 years ago
parent
commit
4d7b62b895
3 changed files with 25 additions and 15 deletions
  1. +7
    -2
      README.md
  2. +10
    -13
      roxbot/cogs/util.py
  3. +8
    -0
      roxbot/converters.py

+ 7
- 2
README.md View File

@@ -22,10 +22,14 @@ _Coming Soon_
- Argument passing has changed to accomdate this. To set the length of a game, you need to put `length=short` or other length options after the command. Example `;tr start mobile length=short` would start a short mobile compatible game.
- Trivia can now default on unicode emojis in case the bot isn't in the emoji server.

**Other**
**NSFW and Reddiyt**
- NSFW and Reddit commands now have a way to delete the output. This is shown by a delete me reaction that will be added to the output. The person who invoked the command then needs to click that reaction within the 20 second timeout to delete the output.
- NSFW commands now have the same system of preventing dupe outputs

**Misc**
- `onthisday` and `numberfact` commands have been added. Interacting with the numbersapi.com's api.
- `warn` and `purge` can now act on users that have left the guild, if their ID is used as the argument.
- Added more info to the `emoji` command.

###### Misc. Changes
- `avatar` now outputs a png if the image is static.
@@ -37,9 +41,10 @@ _Coming Soon_
- added frogtips cache for quicker frogtips

###### Bug Fixes
- Doubled the amount of times subreddit commands will cycle through possible requests to fix JSON decode error.
- Doubled the amount of times subreddit commands will cycle through possible requests to fix JSONDecode error.
- Fixed error in reddit cog due to changing JSON outputs thanks to new reddit redesign.
- Fixed error when trying to use `warn list` on a user that isn't in the list returning an unhelpful error.
- Fixed `emote` error when using a unicode emote by displaying a helpful error message instead of its non-support.

#### v1.6.1
###### Small changes

+ 10
- 13
roxbot/cogs/util.py View File

@@ -176,24 +176,21 @@ class Util():
return await ctx.send("File couldn't be uploaded.")

@bot.command(aliases=["emoji"])
async def emote(self, ctx, emote):
async def emote(self, ctx, emote: roxbot.converters.EmojiConverter):
"""
Uploads the emote given. Useful for downloading emotes.
Usage:
;emote [emote]
"""
emote = emote.strip("<>").split(":")
if emote[0] == "a":
imgname = "emote.gif"
emoji_id = emote[2]
else:
imgname = "emote.png"
emoji_id = emote[2]
url = "https://cdn.discordapp.com/emojis/{}".format(emoji_id)

await roxbot.http.download_file(url, imgname)
await ctx.send(file=discord.File(imgname))
os.remove(imgname)
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)
except IndexError:
return await ctx.send("This command only supports custom emojis at the moment. Sorry.")

@bot.command(hidden=True)
async def inviteme(self, ctx):

+ 8
- 0
roxbot/converters.py View File

@@ -26,3 +26,11 @@ class UserConverter(commands.UserConverter):
raise e

return result

class EmojiConverter(commands.EmojiConverter):
"""Just like the normla EmojiConverter class but with a custom error message and planned extra feature."""
async def convert(self, ctx, argument):
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))

Loading…
Cancel
Save