taxref: fix shrlok issue
This commit is contained in:
parent
ea5acc28e8
commit
97c930ff09
|
@ -100,7 +100,7 @@ class PlaylistOfTheDayPlugin(Plugin):
|
||||||
html_items = map(lambda item: f"<li>{item}</li>", linkified_items)
|
html_items = map(lambda item: f"<li>{item}</li>", linkified_items)
|
||||||
html_list = "<ol>" + "".join(html_items) + "</ol>"
|
html_list = "<ol>" + "".join(html_items) + "</ol>"
|
||||||
data = HTML_TEMPLATE.format(html_list).encode()
|
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:
|
if not url:
|
||||||
self.bot.log_e("Shrlok returned None.")
|
self.bot.log_e("Shrlok returned None.")
|
||||||
self.signal_failure(target)
|
self.signal_failure(target)
|
||||||
|
|
|
@ -230,13 +230,16 @@ class TaxrefPlugin(Plugin):
|
||||||
+ "\n"
|
+ "\n"
|
||||||
)
|
)
|
||||||
reply = shrlok.post({"type": "txt"}, text.encode())
|
reply = shrlok.post({"type": "txt"}, text.encode())
|
||||||
|
if not reply:
|
||||||
|
self.bot.log_d("shrlok plugin returned an empty string.")
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
reply = self.get_ambiguous_reply(items)
|
reply = self.get_ambiguous_reply(items)
|
||||||
|
|
||||||
self.bot.say(target, reply)
|
self.bot.say(target, reply)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def item_to_full_name(item):
|
def item_to_full_name(item: dict) -> str:
|
||||||
family_name = item.get("familyName")
|
family_name = item.get("familyName")
|
||||||
sci_name = item.get("scientificName")
|
sci_name = item.get("scientificName")
|
||||||
return f"{family_name} {sci_name}"
|
return f"{family_name} {sci_name}"
|
||||||
|
|
Loading…
Reference in a new issue