1
0
mirror of https://github.com/civsocit/olgram.git synced 2025-12-18 08:56:17 +00:00

Пример Instance бота, разные команды

This commit is contained in:
mihalin
2021-06-29 15:29:41 +03:00
parent 4e70ebf32c
commit d738da2fa9
15 changed files with 221 additions and 33 deletions

View File

@@ -8,8 +8,8 @@ async def init_database():
# which contain models from "app.models"
await Tortoise.init(
db_url=f'postgres://{DatabaseSettings.user()}:{DatabaseSettings.password()}'
f'@localhost:5431/{DatabaseSettings.database_name()}',
modules={'models': ['olgram.models.bot', 'olgram.models.user']}
f'@localhost:5430/{DatabaseSettings.database_name()}',
modules={'models': ['olgram.models.models']}
)
# Generate the schema
await Tortoise.generate_schemas()

9
olgram/utils/mix.py Normal file
View File

@@ -0,0 +1,9 @@
from aiogram.types import Message
from aiogram.utils.exceptions import TelegramAPIError
async def try_delete_message(message: Message):
try:
await message.delete()
except TelegramAPIError:
pass