ignore case of keywords
This commit is contained in:
parent
72853709ee
commit
6e93a63c40
|
|
@ -22,6 +22,7 @@ python_requires = >=3.8
|
||||||
install_requires =
|
install_requires =
|
||||||
click
|
click
|
||||||
deltachat
|
deltachat
|
||||||
|
requests
|
||||||
|
|
||||||
[options.packages.find]
|
[options.packages.find]
|
||||||
where = src
|
where = src
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import requests
|
||||||
import deltachat
|
import deltachat
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -59,7 +60,7 @@ def rm_keyword(msg: deltachat.Message):
|
||||||
def check_and_forward(msg: deltachat.Message, admin_chat: deltachat.Chat):
|
def check_and_forward(msg: deltachat.Message, admin_chat: deltachat.Chat):
|
||||||
"""Check a message for keywords, and forward it to the admin chat if one matches."""
|
"""Check a message for keywords, and forward it to the admin chat if one matches."""
|
||||||
for word in list_keywords(msg.account):
|
for word in list_keywords(msg.account):
|
||||||
if word in msg.text:
|
if word.lower() in msg.text.lower():
|
||||||
admin_chat.send_msg(msg)
|
admin_chat.send_msg(msg)
|
||||||
print(f"Forwarding message because of '{word}': {msg.text}")
|
print(f"Forwarding message because of '{word}': {msg.text}")
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue