Skip to content

Commit

Permalink
change in error emebed helper
Browse files Browse the repository at this point in the history
This method is to be removed after A default embed helper function #30
  • Loading branch information
vivekashok1221 committed Jan 17, 2021
1 parent d076309 commit 2a3f4b7
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions bot/exts/backend/error_handler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import math
import random
from typing import Iterable, Union
from typing import Optional

import discord
from bot.constants import Channels, Colours, ERROR_REPLIES, NEGATIVE_REPLIES
Expand All @@ -26,13 +26,10 @@ def revert_cooldown_counter(command: commands.Command, message: Message) -> None
)

@staticmethod
def error_embed(message: str, title: Union[Iterable, str] = ERROR_REPLIES) -> Embed:
def error_embed(message: str, title: Optional[str] = None) -> Embed:
"""Build a basic embed with red colour and either a random error title or a title provided."""
embed = Embed(colour=Colours.soft_red)
if isinstance(title, str):
embed.title = title
else:
embed.title = random.choice(title)
title = title or random.choice(ERROR_REPLIES)
embed = Embed(colour=Colours.soft_red, title=title)
embed.description = message
return embed

Expand Down

0 comments on commit 2a3f4b7

Please sign in to comment.