aboutsummaryrefslogtreecommitdiff
path: root/handlers
diff options
context:
space:
mode:
Diffstat (limited to 'handlers')
-rw-r--r--handlers/__init__.py1
-rw-r--r--handlers/gen.py51
2 files changed, 52 insertions, 0 deletions
diff --git a/handlers/__init__.py b/handlers/__init__.py
index 16c0fe7..ab759fd 100644
--- a/handlers/__init__.py
+++ b/handlers/__init__.py
@@ -1,5 +1,6 @@
1from . import leave 1from . import leave
2from . import msg 2from . import msg
3from . import gen
3from . import poll 4from . import poll
4from . import member 5from . import member
5from . import system 6from . import system
diff --git a/handlers/gen.py b/handlers/gen.py
new file mode 100644
index 0000000..822b4ad
--- /dev/null
+++ b/handlers/gen.py
@@ -0,0 +1,51 @@
1import mc
2from aiogram import types as t
3
4from shared import instances as ins
5from shared.instances import dp, bot
6from utils import filters as f
7
8
9@dp.message_handler(f.message.is_chat, commands=["gen"])
10async def сгенерировать_хуету(msg: t.Message):
11 await msg.answer(получить_говно())
12
13
14@dp.message_handler(f.message.is_chat, commands=["del"])
15async def удалить_хуету(msg: t.Message):
16 await msg.delete()
17
18 if msg.reply_to_message:
19 if msg.reply_to_message.from_user.id in [bot.id, msg.from_user.id]:
20 await msg.reply_to_message.delete()
21 else:
22 await msg.answer("Ты умник, можно только свои или мои удалять")
23 else:
24 await msg.answer("Ты умник, ответь на сообщение")
25
26
27@dp.message_handler(commands=["chance"])
28async def изменить_шанс_срания(msg: t.Message):
29 if msg.get_args():
30 try:
31 chance = int(msg.get_args().split()[0])
32 if 0 <= chance <= 100:
33 ins.gen_chance = chance
34 else:
35 raise RuntimeError()
36
37 await msg.answer(f"Теперь я сру с шансом в: {chance}%")
38 except Exception:
39 await msg.answer("Я хз что не так, но я знаю что ты дебил \n /chance <ЧИСЛО ОТ 0 ДО 100>")
40 else:
41 await msg.answer(f"Я сру с шансом в: {ins.gen_chance}%")
42
43
44@dp.message_handler(f.message.chance, f.message.is_chat, content_types=[t.ContentType.ANY])
45async def срать_сообщение_с_шансом(msg: t.Message):
46 await msg.answer(получить_говно())
47
48
49def получить_говно() -> str:
50 samples = mc.util.load_txt_samples('samples.txt', separator='§')
51 return mc.StringGenerator(samples=samples).generate_string().capitalize()