Skip to content

Commit

Permalink
add message for easier debug
Browse files Browse the repository at this point in the history
  • Loading branch information
Hy0tic committed Oct 5, 2024
1 parent 0af3060 commit a79a4c7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions cogs/Emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,27 @@ async def steal(self, ctx, msg):
path = "./cogs/TempImageFolder"

filename = name + extension
download_image(url, path, filename)
try:
download_image(url, path, filename)
except:
await ctx.send(f"{ctx.author.mention} Failed to download emoji")
return

server = ctx.guild
with open("./cogs/TempImageFolder/" + filename, "rb") as file:
emoji_data = file.read()
await server.create_custom_emoji(name=name, image=emoji_data)
try:
with open("./cogs/TempImageFolder/" + filename, "rb") as file:
emoji_data = file.read()
except:
await ctx.send(f"{ctx.author.mention} Failed to read file")
os.remove("./cogs/TempImageFolder/" + filename)
return

try:
await server.create_custom_emoji(name=name, image=emoji_data)
await ctx.send(f"{ctx.author.mention} Emoji Created")
except:
await ctx.send(f"{ctx.author.mention} Failed to create emoji")

os.remove("./cogs/TempImageFolder/" + filename)

async def setup(BOT):
Expand Down

0 comments on commit a79a4c7

Please sign in to comment.