Initial commit

This commit is contained in:
my-dev committed 2024-02-16 13:23:45 +00:00
commit 9638f5a31b
45 files changed
+2421

No files matched your search

+1
View File
@@ -0,0 +1 @@
from app.core._utils.tg_process_template import tg_process_template
+10
View File
@@ -0,0 +1,10 @@
from app.core.models import Asset
from app.core.models.base import AlchemyBase
async def create_maria_tables(engine):
"""Create all tables in the database."""
Asset()
AlchemyBase.metadata.create_all(engine)
+49
View File
@@ -0,0 +1,49 @@
async def tg_process_template(
chat_wrap: 'Wrapped_CBot',
text, keyboard=None, message_id=None,
photo=None, video=None, document=None, **kwargs
):
if (photo or video or document) and message_id:
await chat_wrap.delete_message(message_id)
message_id = None
if message_id:
m = await chat_wrap.edit_message(
message_id,
text,
reply_markup=keyboard,
**kwargs
)
if not (m is None):
return m
await chat_wrap.delete_message(message_id)
if photo:
return await chat_wrap.send_photo(
photo,
caption=text,
reply_markup=keyboard,
**kwargs
)
elif video:
return await chat_wrap.send_video(
video,
caption=text,
reply_markup=keyboard,
**kwargs
)
elif document:
return await chat_wrap.send_document(
document,
caption=text,
reply_markup=keyboard,
**kwargs
)
else:
return await chat_wrap.send_message(
text,
reply_markup=keyboard,
**kwargs
)