Add months-old WIP code, add global get_linker(),get_message(),delete_message() update Telegram, add /getmessage, multi-type media handling, misc fixes

This commit is contained in:
2025-01-20 01:28:27 +01:00
parent 9220c95636
commit 9ccc1027f7
9 changed files with 176 additions and 74 deletions

View File

@ -12,7 +12,7 @@ def cFilters(context:EventContext, data:InputMessageData):
# * (output) setscript <..., script>
# * (output) insert, remove <..., groupid, message>
#arguments = data.command.parse_arguments(4)
if not (action := data.command.arguments.action) or (action not in ["list", "create", "delete"]):
if not (action := data.command.arguments.action) or (action not in ["list", "create", "delete", "insert", "remove"]):
return send_status_400(context, language)
[room_id, filter_id, command_data] = ((None,) * 3)
for token in data.command.tokens[2:]:
@ -41,6 +41,8 @@ def cFilters(context:EventContext, data:InputMessageData):
# TODO filter name validation (no spaces or special symbols, no only numbers)
if filter_id and (len(Filter.select().where((Filter.owner == room_id) & (Filter.name == filter_id)).tuples()) > 0):
return
elif filter_id.isnumeric() or ''.join([c if c not in "abcdefghijklmnopqrstuvwxyz0123456789" else "" for c in filter_id.lower()]):
return
else:
filter_id = Filter.create(name=filter_id, owner=room_id)
return send_status(context, 201, language, f"Filter with id <code>{filter_id}</code> in room <code>{room_id}</code> created successfully.", summary=False)