fix bug checking url entities in message

This commit is contained in:
Rykov7
2022-11-02 12:36:05 +03:00
parent 1b6a6d2d84
commit 6b648e5dbe
+5 -3
View File
@@ -19,6 +19,7 @@ app = Flask(__name__)
print(">>> LutzBot is running! <<<") print(">>> LutzBot is running! <<<")
zen_rows = ['Beautiful is better than ugly.', 'Explicit is better than implicit.', 'Simple is better than complex.', zen_rows = ['Beautiful is better than ugly.', 'Explicit is better than implicit.', 'Simple is better than complex.',
'Complex is better than complicated.', 'Flat is better than nested.', 'Sparse is better than dense.', 'Complex is better than complicated.', 'Flat is better than nested.', 'Sparse is better than dense.',
'Readability counts.', 'Readability counts.',
@@ -63,9 +64,10 @@ def check_delete_list(type_message: types.Message) -> bool:
for phrase in unwanted_phrases: for phrase in unwanted_phrases:
if phrase in type_message.text.casefold(): if phrase in type_message.text.casefold():
return True return True
for entity in type_message.entities: if type_message.entities:
if phrase in entity.url: for entity in type_message.entities:
return True if entity.url and phrase in entity.url:
return True
@bot.message_handler(func=check_delete_list, content_types=['text']) @bot.message_handler(func=check_delete_list, content_types=['text'])