Skip to content

Ensure consistancy in bot responses by outsourcing boilerplates to functions

For instance, command failure messages should be formatted distinctly differently than command success messages. However, I've noticed we have boilerplates for creating message embeds and sending them.

Ideally, we should be able to replace code like

embed=discord.Embed(description='Bot encountered an error playing the song!', color=discord.Colour.magenta())
embed.set_author(name=self.bot.config.name, icon_url=self.bot.config.url)
await ctx.send(embed=embed)

with code like

responses.error(ctx, description='Bot encountered an error playing the song!')

Another layer of abstraction should be possible, in fact:

embed = responses.error_embed(description='Bot encountered an error doing something!')
# Additional code that modifies the embed
await ctx.send(embed=embed)