From a71b0b5703f8596b0f888392a08045ff10d70d5d Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Thu, 7 Nov 2019 18:52:53 -0800 Subject: [PATCH] fix & improve emote voting --- .gitignore | 3 ++- bot.py | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 24f1150..1a337da 100644 --- a/.gitignore +++ b/.gitignore @@ -107,4 +107,5 @@ venv.bak/ .vscode/ # muh token is stored as plain text ehehehehe -token.txt \ No newline at end of file +token.txt +config.json diff --git a/bot.py b/bot.py index 18be9ff..1ae9f48 100644 --- a/bot.py +++ b/bot.py @@ -106,11 +106,14 @@ async def addEmote(ctx, emote_name: str): vote_passed = await take_vote(ctx, "Add emoji `{}`?".format(emote_name), EMOTE_VOTE_TIME, MIN_EMOTE_VOTERS) - # if all_in_favor > not_in_favor and all_in_favor > MIN_EMOTE_VOTERS: - await ctx.send(embed=imgfun(msg, url)) if vote_passed: - file_bytes = await ctx.message.attachments[0].read() - await ctx.guild.create_custom_emoji(name=emote_name, image=file_bytes) + try: + file_bytes = await ctx.message.attachments[0].read() + await ctx.guild.create_custom_emoji(name=emote_name, image=file_bytes) + await ctx.send("`Emote {0} added!` :{0}:".format(emote_name)) + except: + await ctx.send(":warning: `There was an error adding emote {}.`".format(emote_name)) + @bot.command() async def shibe(ctx):