Tidy human readable exception embeds

This commit is contained in:
Corban-Lee Jones 2024-02-16 00:18:43 +00:00
parent bec33503b5
commit 1cb599af80

View File

@ -308,9 +308,15 @@ class FeedCog(commands.Cog):
api = API(self.bot.api_token, session)
data = await api.create_subscription_channel(str(channel.id), sub_uuid)
except Exception as exc:
except aiohttp.ClientResponseError as exc:
return await (
Followup(exc.__class__.__name__, str(exc))
Followup(
f"Error · {exc.message}",
"Ensure you haven't: \n"
"- Already linked this subscription to this channel\n"
"- Already linked this subscription to the maximum of 4 channels"
)
.footer(f"HTTP {exc.code}")
.error()
.send(inter)
)
@ -406,20 +412,26 @@ class FeedCog(commands.Cog):
api = API(self.bot.api_token, session)
data = await api.create_subscription(name, rss_url, image_url, str(inter.guild_id))
except Exception as exc:
except aiohttp.ClientResponseError as exc:
return await (
Followup(exc.__class__.__name__, str(exc))
Followup(
f"Error · {exc.message}",
"Ensure you haven't: \n"
"- Reused an identical name of an existing Subscription\n"
"- Already created the maximum of 25 Subscriptions"
)
.footer(f"HTTP {exc.code}")
.error()
.send(inter)
)
# Omit data we dont want the user to see
data.pop("uuid")
data.pop("image")
data.pop("server")
data.pop("creation_datetime")
# Update keys to be more human readable
data["UUID"] = data.pop("uuid")
data["url"] = data.pop("rss_url")
await (