fix README.md, is_white filter
This commit is contained in:
@@ -42,7 +42,7 @@ ExecStart=/bin/bash -c 'source /home/inferno/lutzpybot/venv/bin/activate; gunico
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
```
|
```
|
||||||
2. Enable and start with `systemctl enable lutz.service`, `systemctl enable lutz.service`.
|
2. Enable and start with `systemctl enable lutz.service`, `systemctl start lutz.service`.
|
||||||
|
|
||||||
### Where can I get more help, if I need it?
|
### Where can I get more help, if I need it?
|
||||||
Bot is easily understandable reading in-code comments of the handler functions, additionally read [PyTelegramBotAPI documentation](url=https://github.com/eternnoir/pyTelegramBotAPI) for library help.
|
Bot is easily understandable reading in-code comments of the handler functions, additionally read [PyTelegramBotAPI documentation](url=https://github.com/eternnoir/pyTelegramBotAPI) for library help.
|
||||||
|
|||||||
+1
-1
@@ -263,7 +263,7 @@ def list_jobs(message):
|
|||||||
bot.send_message(ADMIN_ID, reminder.print_get_jobs())
|
bot.send_message(ADMIN_ID, reminder.print_get_jobs())
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(func=is_admin, commands=['add'])
|
@bot.message_handler(func=is_white, commands=['add'])
|
||||||
def add_stan_quote(message):
|
def add_stan_quote(message):
|
||||||
if message.reply_to_message and message.reply_to_message.text:
|
if message.reply_to_message and message.reply_to_message.text:
|
||||||
with open('Stan.txt', 'a', encoding='utf8') as stan_quotes:
|
with open('Stan.txt', 'a', encoding='utf8') as stan_quotes:
|
||||||
|
|||||||
+7
-3
@@ -2,11 +2,11 @@ from telebot import types
|
|||||||
from .config import *
|
from .config import *
|
||||||
|
|
||||||
|
|
||||||
def check_spam_list(type_message: types.Message) -> bool:
|
def check_spam_list(message: types.Message) -> bool:
|
||||||
""" Check for mentioning unwanted persons in text. """
|
""" Check for mentioning unwanted persons in text. """
|
||||||
if type_message.from_user.username not in WHITEUN and type_message.from_user.id not in WHITEIDS:
|
if message.from_user.username not in WHITEUN and message.from_user.id not in WHITEIDS:
|
||||||
for url in SPAM:
|
for url in SPAM:
|
||||||
if url in type_message.text.casefold():
|
if url in message.text.casefold():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@@ -49,6 +49,10 @@ def is_admin(message: types.Message) -> bool:
|
|||||||
return message.from_user.id == ADMIN_ID
|
return message.from_user.id == ADMIN_ID
|
||||||
|
|
||||||
|
|
||||||
|
def is_white(message: types.Message) -> bool:
|
||||||
|
return message.from_user.username in WHITEUN or message.from_user.id in WHITEIDS
|
||||||
|
|
||||||
|
|
||||||
def send_or_reply(m: types.Message, answer):
|
def send_or_reply(m: types.Message, answer):
|
||||||
if m.reply_to_message:
|
if m.reply_to_message:
|
||||||
bot.reply_to(m.reply_to_message, answer)
|
bot.reply_to(m.reply_to_message, answer)
|
||||||
|
|||||||
Reference in New Issue
Block a user