core: bot qoshildi
This commit is contained in:
58
core/bot/main.py
Normal file
58
core/bot/main.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# python
|
||||
import asyncio, logging, sys, os
|
||||
import django
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.base')
|
||||
django.setup()
|
||||
|
||||
# aiogram
|
||||
from aiogram import Bot, Dispatcher, types, filters
|
||||
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton, WebAppInfo
|
||||
|
||||
# django
|
||||
from django.conf import settings
|
||||
|
||||
TOKEN = settings.BOT_TOKEN
|
||||
|
||||
bot = Bot(token=TOKEN)
|
||||
dp = Dispatcher()
|
||||
|
||||
|
||||
@dp.message(filters.CommandStart)
|
||||
async def start_handler(message: types.Message):
|
||||
keyboard = InlineKeyboardMarkup(
|
||||
inline_keyboard=[
|
||||
[InlineKeyboardButton(
|
||||
text="Tizimga kirish",
|
||||
web_app=WebAppInfo(url="https://bot.meridynpharma.com")
|
||||
)]
|
||||
],
|
||||
)
|
||||
text = """
|
||||
🔐 MeridynPharma ish tizimiga kirish
|
||||
|
||||
Hurmatli xodim,
|
||||
MeridynPharma’ning ichki ish jarayonlarini avtomatlashtirish va kunlik faoliyatni samarali boshqarish uchun mo‘ljallangan Rasmiy Xodimlar Mini-Ilovasiga xush kelibsiz.
|
||||
|
||||
Ushbu platforma orqali sizga biriktirilgan vazifalar, hisobotlar, inventarizatsiya jarayonlari va ichki eslatmalar yagona tizim orqali boshqariladi.
|
||||
|
||||
▶️ Tizimga kirish tartibi
|
||||
|
||||
Ish faoliyatini boshlash uchun quyidagi bosqichni bajaring:
|
||||
|
||||
1. Quyida joylashgan “Tizimga kirish” tugmasini bosing.
|
||||
yoki
|
||||
2. Mini-Ilova ochilgandan so‘ng, mini ilova pastki qismida joylashgan tizimga kirish degan tugmani bosing
|
||||
|
||||
Agar mini-app avtomatik ochilmasa, iltimos, tugmani yana bir bor bosing.
|
||||
"""
|
||||
await message.answer(text, reply_markup=keyboard)
|
||||
|
||||
|
||||
async def main():
|
||||
await dp.start_polling(bot)
|
||||
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
|
||||
asyncio.run(main())
|
||||
@@ -1,3 +1,9 @@
|
||||
aiofiles==25.1.0
|
||||
aiogram==3.23.0
|
||||
aiohappyeyeballs==2.6.1
|
||||
aiohttp==3.13.2
|
||||
aiosignal==1.4.0
|
||||
annotated-types==0.7.0
|
||||
asgiref==3.11.0
|
||||
attrs==25.4.0
|
||||
autobahn==25.11.1
|
||||
@@ -22,20 +28,26 @@ djangorestframework==3.16.1
|
||||
djangorestframework_simplejwt==5.5.1
|
||||
drf-yasg==1.21.11
|
||||
fonttools==4.60.1
|
||||
frozenlist==1.8.0
|
||||
gunicorn==23.0.0
|
||||
h11==0.16.0
|
||||
hyperlink==21.0.0
|
||||
idna==3.11
|
||||
Incremental==24.11.0
|
||||
inflection==0.5.1
|
||||
magic-filter==1.0.12
|
||||
msgpack==1.1.2
|
||||
multidict==6.7.0
|
||||
packaging==25.0
|
||||
pillow==12.0.0
|
||||
propcache==0.4.1
|
||||
psycopg2-binary==2.9.11
|
||||
py-ubjson==0.16.1
|
||||
pyasn1==0.6.1
|
||||
pyasn1_modules==0.4.2
|
||||
pycparser==2.23
|
||||
pydantic==2.12.5
|
||||
pydantic_core==2.41.5
|
||||
pydyf==0.11.0
|
||||
PyJWT==2.10.1
|
||||
pyOpenSSL==25.3.0
|
||||
@@ -51,6 +63,7 @@ tinycss2==1.5.1
|
||||
tinyhtml5==2.0.0
|
||||
Twisted==25.5.0
|
||||
txaio==25.9.2
|
||||
typing-inspection==0.4.2
|
||||
typing_extensions==4.15.0
|
||||
ujson==5.11.0
|
||||
uritemplate==4.2.0
|
||||
@@ -58,6 +71,6 @@ urllib3==2.5.0
|
||||
uvicorn==0.38.0
|
||||
weasyprint==66.0
|
||||
webencodings==0.5.1
|
||||
yarl==1.22.0
|
||||
zope.interface==8.1.1
|
||||
zopfli==0.4.0
|
||||
websockets
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
python3 manage.py collectstatic --noinput
|
||||
python3 manage.py migrate --noinput
|
||||
|
||||
gunicorn config.wsgi:application -b 0.0.0.0:8000 --workers $(($(nproc) * 2 + 1))
|
||||
gunicorn config.wsgi:application -b 0.0.0.0:8000 --workers $(($(nproc) * 2 + 1)) &
|
||||
|
||||
python3 core/bot/main.py &
|
||||
|
||||
wait
|
||||
|
||||
exit $?
|
||||
@@ -2,6 +2,10 @@
|
||||
python3 manage.py collectstatic --noinput
|
||||
python3 manage.py migrate --noinput
|
||||
|
||||
uvicorn config.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir core --reload-dir config
|
||||
uvicorn config.asgi:application --host 0.0.0.0 --port 8000 --reload --reload-dir core --reload-dir config &
|
||||
|
||||
python3 core/bot/main.py &
|
||||
|
||||
wait
|
||||
|
||||
exit $?
|
||||
Reference in New Issue
Block a user