Merge branch 'main' of https://gitea.corbz.dev/corbz/NewsBot
This commit is contained in:
commit
805efd0a60
@ -308,9 +308,15 @@ class FeedCog(commands.Cog):
|
|||||||
api = API(self.bot.api_token, session)
|
api = API(self.bot.api_token, session)
|
||||||
data = await api.create_subscription_channel(str(channel.id), sub_uuid)
|
data = await api.create_subscription_channel(str(channel.id), sub_uuid)
|
||||||
|
|
||||||
except Exception as exc:
|
except aiohttp.ClientResponseError as exc:
|
||||||
return await (
|
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()
|
.error()
|
||||||
.send(inter)
|
.send(inter)
|
||||||
)
|
)
|
||||||
@ -406,20 +412,26 @@ class FeedCog(commands.Cog):
|
|||||||
api = API(self.bot.api_token, session)
|
api = API(self.bot.api_token, session)
|
||||||
data = await api.create_subscription(name, rss_url, image_url, str(inter.guild_id))
|
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 (
|
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()
|
.error()
|
||||||
.send(inter)
|
.send(inter)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Omit data we dont want the user to see
|
# Omit data we dont want the user to see
|
||||||
|
data.pop("uuid")
|
||||||
data.pop("image")
|
data.pop("image")
|
||||||
data.pop("server")
|
data.pop("server")
|
||||||
data.pop("creation_datetime")
|
data.pop("creation_datetime")
|
||||||
|
|
||||||
# Update keys to be more human readable
|
# Update keys to be more human readable
|
||||||
data["UUID"] = data.pop("uuid")
|
|
||||||
data["url"] = data.pop("rss_url")
|
data["url"] = data.pop("rss_url")
|
||||||
|
|
||||||
await (
|
await (
|
||||||
|
@ -266,6 +266,13 @@ class Followup:
|
|||||||
|
|
||||||
return self
|
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):
|
def footer(self, text: str, icon_url: str = None):
|
||||||
""""""
|
""""""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user