This commit is contained in:
Corban-Lee Jones 2024-02-17 19:10:00 +00:00
commit 805efd0a60
2 changed files with 24 additions and 5 deletions

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 (

View File

@ -266,6 +266,13 @@ class Followup:
return self
def author(self, name: str, url: str=None, icon_url: str=None):
""""""
self._embed.set_author(name=name, url=url, icon_url=icon_url)
return self
def footer(self, text: str, icon_url: str = None):
""""""