Fixed errors. Added # to markdown filter

This commit is contained in:
Joan
2023-03-08 12:38:02 +01:00
parent de28241edf
commit f7b6512500
5 changed files with 14 additions and 13 deletions

View File

@@ -1,9 +1,10 @@
version: "3"
services:
wallamanta-bot:
wallamanta-bot-multiuser:
build: wallamanta
container_name: wallamanta-bot
image: wallamanta:multiuser
container_name: wallamanta-bot-multiuser
volumes:
- ./data:/app/data
restart: unless-stopped

View File

@@ -1,7 +1,7 @@
from datetime import datetime, timedelta
#TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '+', '-', '=', '|', '{', '}', '.', '!']
TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
ADMIN_IDS = [10101691]
def telegram_escape_characters(text):

View File

@@ -62,7 +62,7 @@ def add_premium_user(telegram_user_id, until):
cur.execute(f"INSERT INTO users VALUES ({telegram_user_id}, True, 'premium', '{until}')")
con.commit()
else:
cur.execute(f"UPDATE users SET active = True, type = 'premium', until = {until} WHERE telegram_user_id={telegram_user_id}")
cur.execute(f"UPDATE users SET active = True, type = 'premium', until = '{until}' WHERE telegram_user_id={telegram_user_id}")
con.commit()
found = True
con.close()

View File

@@ -54,13 +54,13 @@ async def add_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> Non
valid = False
if walladb.is_user_testing(telegram_user_id):
valid = True
if number_of_products > 5:
message = "Tienes más de 5 productos en seguimiento. Con premium puedes tener hasta 20."
if number_of_products >= 5:
message = "Ya tienes 5 productos en seguimiento. Con premium puedes tener hasta 20."
valid = False
elif walladb.is_user_premium(telegram_user_id):
valid = True
if number_of_products > 20:
message = "Tienes más de 20 productos en seguimiento. Borra algunos para añadir más."
if number_of_products >= 20:
message = "Ya tienes 20 productos en seguimiento. Borra algunos para añadir más."
valid = False
if valid:
args = update.message.text.split("/add ")
@@ -135,10 +135,10 @@ async def admin_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> N
async def add_premium_user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
if helpers.is_user_admin(update.message.chat_id):
telegram_user_id = update.message.text.split('/add_premium_user ')[1]
days = update.message.text.split('/add_premium_user ')[2]
until = helpers.get_date_ahead(days)
if walladb.add_premium_user(telegram_user_id, until):
telegram_user_id = update.message.text.split('/add_premium_user ')[1].split(' ')[0]
days = update.message.text.split('/add_premium_user ')[1].split(' ')[1]
until = helpers.get_date_ahead(int(days))
if not walladb.add_premium_user(telegram_user_id, until):
products = walladb.get_products_from_user(telegram_user_id)
for product in products:

View File

@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
class Worker:
def is_valid_request(product):
def is_valid_request(self, product):
is_valid = True
if not walladb.get_product(product):
is_valid = False