From 52116229e6b7dd1fca898e63cfd3681819cf73a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sk=C3=BDpala?= Date: Tue, 7 Nov 2023 21:57:20 +0100 Subject: [PATCH] News: Use KSP_URL as a constant And don't have it copied everywhere --- hrochobot/cogs/news.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hrochobot/cogs/news.py b/hrochobot/cogs/news.py index c4c61f1..71e3f9b 100644 --- a/hrochobot/cogs/news.py +++ b/hrochobot/cogs/news.py @@ -6,7 +6,7 @@ from markdownify import markdownify import re from bs4 import BeautifulSoup -from hrochobot.utils.ksp_utils import ksp_feed +from hrochobot.utils.ksp_utils import ksp_feed, KSP_URL import hrochobot.utils.data as data NEWS_JSON = "news" @@ -43,7 +43,7 @@ def format_entry(entry, author=None): if author: embed.set_author(name=author) - embed.set_thumbnail(url="https://ksp.mff.cuni.cz/img/hippo_head.png") + embed.set_thumbnail(url=f"{KSP_URL}/img/hippo_head.png") date = datetime.fromisoformat(entry.published) embed.set_footer(text=date.strftime("%-d. %-m. %Y")) @@ -57,7 +57,7 @@ async def post_news(bot, guild, entry_id): channel = get(guild.channels, id=news_json["news_channel"]) feed = await ksp_feed() - entries_with_id = list(filter(lambda e: e.id == f"https://ksp.mff.cuni.cz/{entry_id}", feed.entries)) + entries_with_id = list(filter(lambda e: e.id == f"{KSP_URL}/{entry_id}", feed.entries)) if len(entries_with_id) == 0: return f"Entry with id ``{entry_id}`` not found."