-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_handler.py
35 lines (26 loc) · 1.05 KB
/
user_handler.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
from aiogram.dispatcher.filters import Text
from aiogram.types import ContentType, Message
from dotenv import load_dotenv
from loader import bot, dp
load_dotenv()
ADMIN_IDS = os.getenv('ADMIN_ID').split(',')
ADMIN_IDS = [int(_id) for _id in ADMIN_IDS if _id]
@dp.message_handler(content_types=ContentType.PHOTO)
async def send_photo(msg: Message):
photo_file_id = msg.photo[-1].file_id
text = f"Forwarded from {msg.from_user.first_name}"
if mes := msg.caption:
text += f"\n{mes}"
for admin_id in ADMIN_IDS:
await bot.send_photo(admin_id, photo=photo_file_id, caption=text)
await msg.answer('⏳')
@dp.message_handler(Text(contains='Assalom', ignore_case=True))
@dp.message_handler(Text(equals='Assalomu alaykum', ignore_case=True))
async def hello_message(msg: Message):
await msg.reply("Vaalaykum assalom va Rohmatulloh 🙂")
@dp.message_handler()
async def response(msg: Message):
for admin_id in ADMIN_IDS:
await bot.forward_message(admin_id, msg.chat.id, msg.message_id)
await msg.answer('⏳')