init
This commit is contained in:
11
bot/handlers/__init__.py
Normal file
11
bot/handlers/__init__.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from aiogram import Router
|
||||
|
||||
from bot.middlewares import LikeMiddleware
|
||||
|
||||
from . import initialize, on_1686, start, inline
|
||||
|
||||
router = Router()
|
||||
|
||||
router.message.middleware(LikeMiddleware())
|
||||
|
||||
router.include_routers(initialize.router, start.router, on_1686.router, inline.router)
|
||||
3
bot/handlers/initialize/__init__.py
Normal file
3
bot/handlers/initialize/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .initializer import router
|
||||
|
||||
__all__ = ["router"]
|
||||
9
bot/handlers/initialize/initializer.py
Normal file
9
bot/handlers/initialize/initializer.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from aiogram import Bot, Router
|
||||
from rich import print
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.startup()
|
||||
async def startup(bot: Bot):
|
||||
print(f"[green]Started as[/] @{(await bot.me()).username}")
|
||||
4
bot/handlers/inline/__init__.py
Normal file
4
bot/handlers/inline/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .on_inline import router
|
||||
|
||||
|
||||
__all__ = ["router"]
|
||||
20
bot/handlers/inline/on_inline.py
Normal file
20
bot/handlers/inline/on_inline.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from aiogram import Router
|
||||
|
||||
from aiogram.types import InlineQuery
|
||||
from aiogram.types import InlineQueryResultCachedVoice
|
||||
|
||||
from ...utils.config import config
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.inline_query()
|
||||
async def default_inline_query(inline_query: InlineQuery):
|
||||
await inline_query.answer(
|
||||
[
|
||||
InlineQueryResultCachedVoice(
|
||||
id=id_[-1:-8:-1], voice_file_id=id_, title=config.send[id_]
|
||||
)
|
||||
for id_ in config.send.keys()
|
||||
]
|
||||
)
|
||||
3
bot/handlers/on_1686/__init__.py
Normal file
3
bot/handlers/on_1686/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .h1686 import router
|
||||
|
||||
__all__ = ["router"]
|
||||
16
bot/handlers/on_1686/h1686.py
Normal file
16
bot/handlers/on_1686/h1686.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from aiogram import Router, types
|
||||
|
||||
from ...filters import Filter1686, FilterBusiness1686
|
||||
from ...utils.config import config
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(Filter1686())
|
||||
async def on_message(message: types.Message):
|
||||
await message.reply_voice(list(config.send.keys())[0])
|
||||
|
||||
|
||||
@router.business_message(FilterBusiness1686())
|
||||
async def on_business_message(business_message: types.Message):
|
||||
await business_message.reply_voice(list(config.send.keys())[0])
|
||||
3
bot/handlers/start/__init__.py
Normal file
3
bot/handlers/start/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .start import router
|
||||
|
||||
__all__ = ["router"]
|
||||
9
bot/handlers/start/start.py
Normal file
9
bot/handlers/start/start.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from aiogram import Router, types
|
||||
from aiogram.filters import Command
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@router.message(Command("start"))
|
||||
async def on_start(message: types.Message):
|
||||
await message.reply(text="1686")
|
||||
Reference in New Issue
Block a user