aboutsummaryrefslogtreecommitdiff
path: root/handlers/gen.py
blob: ef397dba9120a4b9fb4c8903b1082f39462b7056 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from aiogram import types as t

from shared.instances import chats, dp
from shared.samples import samples
from utils import filters as f


@dp.message_handler(commands=["gen"])
async def gen_command(msg: t.Message) -> None:
    if chats.get(msg.chat.id).gen.delete_command:
        await msg.delete()
    await msg.answer(samples.get(msg.chat.id).generate())


@dp.message_handler(
    f.message.is_chat,
    f.message.chance,
    content_types=[t.ContentType.ANY],
)
async def chance_message(msg: t.Message) -> None:
    if chats.get(msg.chat.id).gen.reply:
        await msg.reply(samples.get(msg.chat.id).generate())
    else:
        await msg.answer(samples.get(msg.chat.id).generate())