diff options
author | 2022-08-09 18:48:39 -0400 | |
---|---|---|
committer | 2022-08-09 18:48:39 -0400 | |
commit | 2354d05a1a3ec029a5d85d753e5147c000f53044 (patch) | |
tree | 9478af74c5de9a55f5a8e4ba201912c10e853758 | |
parent | Refactored get_discord_message to not unnecessarily log, and cleaned up uwu_c... (diff) |
Add error handling to get_discord_message
-rw-r--r-- | bot/utils/messages.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bot/utils/messages.py b/bot/utils/messages.py index 71b634e8..b0c95583 100644 --- a/bot/utils/messages.py +++ b/bot/utils/messages.py @@ -3,6 +3,7 @@ import re from typing import Callable, Optional, Union from discord import Embed, Message +from discord.ext import commands from discord.ext.commands import Context, MessageConverter log = logging.getLogger(__name__) @@ -32,7 +33,10 @@ async def get_discord_message(ctx: Context, text: str) -> Union[Message, str]: Conversion will succeed if given a discord Message ID or link. Returns `text` if the conversion fails. """ - text = await MessageConverter().convert(ctx, text) + try: + text = await MessageConverter().convert(ctx, text) + except commands.BadArgument: + pass return text |