Как присоединить сюда admin_id
@dp.message_handler(content_types=["photo"])
async def spam_photo(message: types.Message):
file_id = message.photo[-1].file_id
users = db.get_subscriptions()
for i in users:
await bot.send_photo(chat_id=int(i[0]), photo=file_id)
await asyncio.sleep(1)
await message.answer("ОТправка завершена")
Ответы (1 шт):
Автор решения: Amgarak
→ Ссылка
Добавь условие, примерно так:
@dp.message_handler(content_types=["photo"])
async def spam_photo(message: types.Message):
if message.from_user.id == ADMIN_ID:
file_id = message.photo[-1].file_id
users = db.get_subscriptions()
for i in users:
await bot.send_photo(chat_id=int(i[0]), photo=file_id)
await asyncio.sleep(1)
await message.answer("Отправка завершена")
else:
await message.answer("Только админ может выполнять эту команду.")