|
|
|
@ -31,6 +31,7 @@ class JourneeMondialePlugin(Plugin):
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
REQUIRED_CONFIGS = ["commands", "dates", "no_entry_reply"]
|
|
|
|
|
JMCOM_URL = "https://www.journee-mondiale.com"
|
|
|
|
|
|
|
|
|
|
def __init__(self, bot):
|
|
|
|
|
super().__init__(bot)
|
|
|
|
@ -64,11 +65,11 @@ class JourneeMondialePlugin(Plugin):
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
days = ", ".join(today_obs)
|
|
|
|
|
return reply
|
|
|
|
|
return days
|
|
|
|
|
|
|
|
|
|
def get_jmcom_days(self) -> str:
|
|
|
|
|
"""Get international days from journee-mondiale.com."""
|
|
|
|
|
response = http_get(self.config["url"])
|
|
|
|
|
response = http_get(JourneeMondialePlugin.JMCOM_URL)
|
|
|
|
|
if not response:
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
@ -77,13 +78,16 @@ class JourneeMondialePlugin(Plugin):
|
|
|
|
|
try:
|
|
|
|
|
items = soup.find("div", id="journeesDuJour").find_all("article")
|
|
|
|
|
for item in items:
|
|
|
|
|
entries.append({
|
|
|
|
|
entries.append(
|
|
|
|
|
{
|
|
|
|
|
"url": item.find("a").href,
|
|
|
|
|
"title": item.find("h2").string,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
except (ValueError, KeyError):
|
|
|
|
|
return ""
|
|
|
|
|
|
|
|
|
|
# TODO add plus plugin support
|
|
|
|
|
|
|
|
|
|
return ", ".join(map(lambda i: i["title"], entries))
|
|
|
|
|
days = ", ".join(map(lambda i: i["title"], entries))
|
|
|
|
|
return days
|
|
|
|
|