Merge pull request #17 from ctx77/main

merge upstream
This commit is contained in:
Context 77
2024-12-14 13:49:39 +01:00
committed by GitHub
@@ -21,10 +21,11 @@ class ICDObserver(PrivMsgObserverPrototype):
return None return None
def update_on_priv_msg(self, data, connection: Connection): def update_on_priv_msg(self, data, connection: Connection):
if data["message"].startswith(".icd "):
if data["channel"] == connection.details.get_channel(): if data["channel"] == connection.details.get_channel():
regex = r"\b(\w\d{2}\.?\d?\d?)\b" regex = r"\b(\w\d{2}\.?\d?\d?)\b"
codes = re.findall(regex, data["message"]) codes = re.findall(regex, data["message"])
for code in codes: for code in codes[:5]:
code = code.capitalize() code = code.capitalize()
text = self.icd10_dict.get(code, False) text = self.icd10_dict.get(code, False)
if text == False: if text == False: