Made Botty Case Insensitive

This commit is contained in:
BaerbelBox
2024-02-09 19:58:11 +01:00
parent 0c8ff9179b
commit 290bda4fce
6 changed files with 13 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ class GlossaryModule(PrivMsgObserverPrototype):
self._config = config
def update_on_priv_msg(self, data, connection: Connection):
msg = data['message']
msg = data['messageCaseSensitive']
if msg.startswith(GlossaryModule._REMOVE_EXPLANATION):
self._remove_query(data, connection)
elif msg.startswith(GlossaryModule._ADD_EXPLANATION):
@@ -84,7 +84,7 @@ class GlossaryModule(PrivMsgObserverPrototype):
connection.send_back("Dir fehlen leider die Rechte zum Hinzufügen von Einträgen, " + data['nick'] + ".",
data)
return
msg = data['message'].split(GlossaryModule._ADD_EXPLANATION)[1].strip()
msg = data['messageCaseSensitive'].split(GlossaryModule._ADD_EXPLANATION)[1].strip()
split = msg.split(' ', 1)
glossary_provider = GlossaryProvider()
glossary_provider.save_or_replace(split[0], split[1])

View File

@@ -18,7 +18,7 @@ class IntroductionObserver(PrivMsgObserverPrototype):
return ".me - kann von registrierten Nutzern verwendet werden um eine Vorstellung zu speichern"
def update_on_priv_msg(self, data, connection: Connection):
msg = data["message"]
msg = data['messageCaseSensitive']
nick = data["nick"]
if not msg.startswith(".me") and not msg.startswith(".me-"):
return

View File

@@ -15,6 +15,6 @@ class TellObserver(PrivMsgObserverPrototype):
def update_on_priv_msg(self, data, connection: Connection):
if data['message'].find('.tell') != -1 and self._is_idented_mod(data, connection):
connection.send_channel(data['message'][6:])
connection.send_channel(data['messageCaseSensitive'][6:])
def _is_idented_mod(self, data: dict, connection: Connection):
return data['nick'] in self._config.mods and connection.is_idented(data['nick'])

View File

@@ -18,7 +18,7 @@ class TitleObserver(PrivMsgObserverPrototype):
def update_on_priv_msg(self, data, connection: Connection):
regex = "(?P<url>https?://[^\s]+)"
url = re.search(regex, data['message'])
url = re.search(regex, data['messageCaseSensitive'])
if url is not None:
url = url.group()
print(url)