Fixed errors. Added # to markdown filter
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
version: "3"
|
version: "3"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
wallamanta-bot:
|
wallamanta-bot-multiuser:
|
||||||
build: wallamanta
|
build: wallamanta
|
||||||
container_name: wallamanta-bot
|
image: wallamanta:multiuser
|
||||||
|
container_name: wallamanta-bot-multiuser
|
||||||
volumes:
|
volumes:
|
||||||
- ./data:/app/data
|
- ./data:/app/data
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
#TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
|
#TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
|
||||||
TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '+', '-', '=', '|', '{', '}', '.', '!']
|
TELEGRAM_ESCAPE_CHARACTERS = ['_', '*', '[', ']', '(', ')', '~', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!']
|
||||||
ADMIN_IDS = [10101691]
|
ADMIN_IDS = [10101691]
|
||||||
|
|
||||||
def telegram_escape_characters(text):
|
def telegram_escape_characters(text):
|
||||||
|
|||||||
@@ -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}')")
|
cur.execute(f"INSERT INTO users VALUES ({telegram_user_id}, True, 'premium', '{until}')")
|
||||||
con.commit()
|
con.commit()
|
||||||
else:
|
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()
|
con.commit()
|
||||||
found = True
|
found = True
|
||||||
con.close()
|
con.close()
|
||||||
|
|||||||
@@ -54,13 +54,13 @@ async def add_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> Non
|
|||||||
valid = False
|
valid = False
|
||||||
if walladb.is_user_testing(telegram_user_id):
|
if walladb.is_user_testing(telegram_user_id):
|
||||||
valid = True
|
valid = True
|
||||||
if number_of_products > 5:
|
if number_of_products >= 5:
|
||||||
message = "Tienes más de 5 productos en seguimiento. Con premium puedes tener hasta 20."
|
message = "Ya tienes 5 productos en seguimiento. Con premium puedes tener hasta 20."
|
||||||
valid = False
|
valid = False
|
||||||
elif walladb.is_user_premium(telegram_user_id):
|
elif walladb.is_user_premium(telegram_user_id):
|
||||||
valid = True
|
valid = True
|
||||||
if number_of_products > 20:
|
if number_of_products >= 20:
|
||||||
message = "Tienes más de 20 productos en seguimiento. Borra algunos para añadir más."
|
message = "Ya tienes 20 productos en seguimiento. Borra algunos para añadir más."
|
||||||
valid = False
|
valid = False
|
||||||
if valid:
|
if valid:
|
||||||
args = update.message.text.split("/add ")
|
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:
|
async def add_premium_user_command(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||||
if helpers.is_user_admin(update.message.chat_id):
|
if helpers.is_user_admin(update.message.chat_id):
|
||||||
telegram_user_id = update.message.text.split('/add_premium_user ')[1]
|
telegram_user_id = update.message.text.split('/add_premium_user ')[1].split(' ')[0]
|
||||||
days = update.message.text.split('/add_premium_user ')[2]
|
days = update.message.text.split('/add_premium_user ')[1].split(' ')[1]
|
||||||
until = helpers.get_date_ahead(days)
|
until = helpers.get_date_ahead(int(days))
|
||||||
if walladb.add_premium_user(telegram_user_id, until):
|
if not walladb.add_premium_user(telegram_user_id, until):
|
||||||
products = walladb.get_products_from_user(telegram_user_id)
|
products = walladb.get_products_from_user(telegram_user_id)
|
||||||
|
|
||||||
for product in products:
|
for product in products:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class Worker:
|
class Worker:
|
||||||
|
|
||||||
def is_valid_request(product):
|
def is_valid_request(self, product):
|
||||||
is_valid = True
|
is_valid = True
|
||||||
if not walladb.get_product(product):
|
if not walladb.get_product(product):
|
||||||
is_valid = False
|
is_valid = False
|
||||||
|
|||||||
Reference in New Issue
Block a user