Make emoji send a nice embed on emoji creation, or send the actual error as a message if it fails

This commit is contained in:
Luke Robles 2022-05-20 10:06:01 -07:00
parent 60b84e0ec2
commit 11a9dc838b
2 changed files with 7 additions and 3 deletions

View File

@ -1,6 +1,7 @@
from discord.ext import commands from discord.ext import commands
import discord import discord
import os import os
import core_utils
class ServerUtils(commands.Cog): class ServerUtils(commands.Cog):
@ -52,11 +53,14 @@ class ServerUtils(commands.Cog):
image=open(emoji_staging, "rb").read(), image=open(emoji_staging, "rb").read(),
) )
await ctx.send( await ctx.send(
"Emoji created! heres how it looks in a sentence\n\n%s" % emoji_id embed=core_utils.generate_embed(
embed_title="New emoji: %s" % emoji_name,
embed_description=emoji_id,
)
) )
except Exception as e: except Exception as e:
await ctx.send( await ctx.send(
"I wasnt able to upload that image as an emoji. Sorry\n %s" % e "I wasnt able to upload that image as an emoji. Sorry\n\nError: %s" % e
) )
os.remove(emoji_staging) os.remove(emoji_staging)
return return

View File

@ -6,7 +6,7 @@ replicaCount: 1
image: image:
# Overrides the image tag whose default is the chart appVersion. # Overrides the image tag whose default is the chart appVersion.
tag: "203" tag: "204"
repository: ldooks/dragon-bot repository: ldooks/dragon-bot
pullPolicy: IfNotPresent pullPolicy: IfNotPresent