From 347afcf54c762c04a6a5e8ee3b950371ff420b75 Mon Sep 17 00:00:00 2001 From: nex Date: Sat, 18 Nov 2023 19:10:19 +0000 Subject: [PATCH] Fix incorrect asset reference --- cogs/events.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cogs/events.py b/cogs/events.py index 038ba3c..f6728e7 100644 --- a/cogs/events.py +++ b/cogs/events.py @@ -454,7 +454,7 @@ class Events(commands.Cog): r"scrapped(\sit)?|((7\s|seven\s)?different\s)?bins|(meat\s|flying\s)?tax": { "file": discord.File(assets / "scrapped.m4a") }, - r"peppa|pig": {"file": discord.File(assets / "peppa.m4a")}, + r"peppa|pig": {"file": discord.File(assets / "peppa-pig.m4a")}, r"brush|hair": {"file": discord.File(assets / "brush.m4a")}, r"((cup\s)?of\s)?tea": {"file": discord.File(assets / "tea.m4a")}, } @@ -491,6 +491,12 @@ class Events(commands.Cog): break else: continue + elif data.get("file"): + # Check the file exists + if not isinstance(data["file"], discord.File): + data["file"] = discord.File(data["file"]) + if not data["file"].fp.exists(): + continue if meta.get("sub") is not None and isinstance(meta["sub"], dict): content = re.sub(meta["sub"]["pattern"], meta["sub"]["with"], message.content)