Initial commit
This commit is contained in:
commit
9638f5a31b
45 files changed
+2421
No files matched your search
@@ -0,0 +1 @@
|
||||
from app.core._utils.tg_process_template import tg_process_template
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user