Compare commits
No commits in common. "11ad1c43c9068c0bce13c44867588206014c243a" and "e151ae5269bb7edf816540b26c2e7abdb397d3da" have entirely different histories.
11ad1c43c9
...
e151ae5269
2 changed files with 2 additions and 28 deletions
30
main.py
30
main.py
|
|
@ -7,10 +7,10 @@ from pathlib import Path
|
||||||
from textwrap import wrap
|
from textwrap import wrap
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from aiogram import Bot, Dispatcher, F, types
|
from aiogram import Bot, Dispatcher, F
|
||||||
from aiogram.enums import ParseMode
|
from aiogram.enums import ParseMode
|
||||||
from aiogram.filters import Command, CommandStart
|
from aiogram.filters import Command, CommandStart
|
||||||
from aiogram.types import BufferedInputFile, Message, BotCommand, FSInputFile
|
from aiogram.types import BufferedInputFile, Message, BotCommand
|
||||||
from aiogram.client.default import DefaultBotProperties
|
from aiogram.client.default import DefaultBotProperties
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
from datetime import datetime, time, timedelta
|
from datetime import datetime, time, timedelta
|
||||||
|
|
@ -364,7 +364,6 @@ async def handle_gen_mem(message: Message, bot: Bot):
|
||||||
|
|
||||||
await message.reply_photo(BufferedInputFile(output.getvalue(), filename="meme.jpg"))
|
await message.reply_photo(BufferedInputFile(output.getvalue(), filename="meme.jpg"))
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
async def handle_size(message: Message):
|
async def handle_size(message: Message):
|
||||||
size = round(random.uniform(0.1, 35.0), 1)
|
size = round(random.uniform(0.1, 35.0), 1)
|
||||||
|
|
||||||
|
|
@ -385,27 +384,6 @@ async def handle_size(message: Message):
|
||||||
f"📏 Твой хуек: {size} см\n"
|
f"📏 Твой хуек: {size} см\n"
|
||||||
f"Ты: {status}"
|
f"Ты: {status}"
|
||||||
)
|
)
|
||||||
=======
|
|
||||||
KEYWORDS = {'крип', 'радиохэд', 'creep', 'radiohead'}
|
|
||||||
# I'M CREEP
|
|
||||||
async def handle_keywords(message: types.Message):
|
|
||||||
|
|
||||||
if message.text and message.text.startswith('/'):
|
|
||||||
return
|
|
||||||
|
|
||||||
text = message.text.lower()
|
|
||||||
|
|
||||||
if any(re.search(rf'\b{word}\b', text) for word in KEYWORDS):
|
|
||||||
audio_path = BASE_DIR / "maket" / "Radiohead - Creep.mp3"
|
|
||||||
|
|
||||||
if audio_path.exists():
|
|
||||||
await message.answer_audio(
|
|
||||||
audio=FSInputFile(audio_path),
|
|
||||||
caption="I'm a creep, I'm a weirdo..."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.warning(f"Файл не найден по пути: {audio_path}")
|
|
||||||
>>>>>>> SUDOZOVCHIK-CREEP-FUNCTION
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -439,15 +417,11 @@ def main():
|
||||||
dp.message.register(handle_maket, Command("maket"))
|
dp.message.register(handle_maket, Command("maket"))
|
||||||
dp.message.register(handle_size, Command("size"))
|
dp.message.register(handle_size, Command("size"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def handle_gen_mem_cmd(message: Message, bot: Bot):
|
async def handle_gen_mem_cmd(message: Message, bot: Bot):
|
||||||
await handle_gen_mem(message, bot)
|
await handle_gen_mem(message, bot)
|
||||||
|
|
||||||
dp.message.register(handle_gen_mem_cmd, Command("gen_mem"))
|
dp.message.register(handle_gen_mem_cmd, Command("gen_mem"))
|
||||||
|
|
||||||
dp.message.register(handle_keywords, F.text)
|
|
||||||
|
|
||||||
logger.info("Bot is starting...")
|
logger.info("Bot is starting...")
|
||||||
asyncio.run(dp.start_polling(bot, allowed_updates=dp.resolve_used_update_types()))
|
asyncio.run(dp.start_polling(bot, allowed_updates=dp.resolve_used_update_types()))
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue