taxref: fix shrlok issue

master
dece 1 year ago
parent ea5acc28e8
commit 97c930ff09

@ -100,7 +100,7 @@ class PlaylistOfTheDayPlugin(Plugin):
html_items = map(lambda item: f"<li>{item}</li>", linkified_items)
html_list = "<ol>" + "".join(html_items) + "</ol>"
data = HTML_TEMPLATE.format(html_list).encode()
url = self.shrlok_plugin.post({"type": "raw"}, data)
url = self.shrlok_plugin.post({"type": "raw", "ext": "html"}, data)
if not url:
self.bot.log_e("Shrlok returned None.")
self.signal_failure(target)

@ -230,13 +230,16 @@ class TaxrefPlugin(Plugin):
+ "\n"
)
reply = shrlok.post({"type": "txt"}, text.encode())
if not reply:
self.bot.log_d("shrlok plugin returned an empty string.")
return
else:
reply = self.get_ambiguous_reply(items)
self.bot.say(target, reply)
@staticmethod
def item_to_full_name(item):
def item_to_full_name(item: dict) -> str:
family_name = item.get("familyName")
sci_name = item.get("scientificName")
return f"{family_name} {sci_name}"

Loading…
Cancel
Save