Compare commits
No commits in common. "93d8c2187a67ed10665a22deec62d4f39cb61ea8" and "107a0647d104039596de3f8d4033157df522e3a2" have entirely different histories.
93d8c2187a
...
107a0647d1
3 changed files with 0 additions and 62 deletions
|
|
@ -27,10 +27,6 @@ POLYCHAETSI_IMAGE_PATH = BASE_DIR / "maket" / "cvetok.jpg"
|
||||||
# --- Казино ---
|
# --- Казино ---
|
||||||
CASINO_MAX_BET = 1.0
|
CASINO_MAX_BET = 1.0
|
||||||
|
|
||||||
# --- E621 API ---
|
|
||||||
E621_LOGIN = os.getenv("E621_LOGIN", "")
|
|
||||||
E621_API_KEY = os.getenv("E621_API_KEY", "")
|
|
||||||
|
|
||||||
# --- Ставки на матчи ---
|
# --- Ставки на матчи ---
|
||||||
ODDS_API_KEY = os.getenv("ODDS_API_KEY", "")
|
ODDS_API_KEY = os.getenv("ODDS_API_KEY", "")
|
||||||
ODDS_API_BASE = "https://api.the-odds-api.com/v4"
|
ODDS_API_BASE = "https://api.the-odds-api.com/v4"
|
||||||
|
|
@ -213,7 +209,6 @@ def get_hint_text(templates_str: str) -> str:
|
||||||
"• /bet [спорт] [номер] [исход] [ставка] — поставить см.\n"
|
"• /bet [спорт] [номер] [исход] [ставка] — поставить см.\n"
|
||||||
"• /mybets — мои ставки.\n"
|
"• /mybets — мои ставки.\n"
|
||||||
"• /ebalnik — включить/выключить автоответы в чате.\n"
|
"• /ebalnik — включить/выключить автоответы в чате.\n"
|
||||||
"• /uwu [теги] — случайная картинка с e621.\n"
|
|
||||||
"• /polychaetsi — топ по слову «получается».\n"
|
"• /polychaetsi — топ по слову «получается».\n"
|
||||||
"• /prices /fetch — цены и остатки Магнита.\n"
|
"• /prices /fetch — цены и остатки Магнита.\n"
|
||||||
"Подсказка: в группах пиши /команда@username_бота."
|
"Подсказка: в группах пиши /команда@username_бота."
|
||||||
|
|
|
||||||
54
games/uwu.py
54
games/uwu.py
|
|
@ -1,54 +0,0 @@
|
||||||
import aiohttp
|
|
||||||
from aiogram import types
|
|
||||||
import config
|
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
async def handle_uwu_cmd(message: types.Message):
|
|
||||||
args = message.text.split(maxsplit=1)
|
|
||||||
tags = "rating:safe score:>500"
|
|
||||||
if len(args) > 1:
|
|
||||||
tags = args[1].strip()
|
|
||||||
|
|
||||||
tags += " order:random"
|
|
||||||
|
|
||||||
url = "https://e621.net/posts.json"
|
|
||||||
params = {
|
|
||||||
"tags": tags,
|
|
||||||
"limit": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
auth = None
|
|
||||||
if config.E621_LOGIN and config.E621_API_KEY:
|
|
||||||
auth = aiohttp.BasicAuth(config.E621_LOGIN, config.E621_API_KEY)
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
"User-Agent": f"Sex Bomba TG Bot/1.0 (by {config.E621_LOGIN or 'unknown'} on e621)"
|
|
||||||
}
|
|
||||||
|
|
||||||
try:
|
|
||||||
async with aiohttp.ClientSession() as session:
|
|
||||||
async with session.get(url, params=params, headers=headers, auth=auth) as resp:
|
|
||||||
if resp.status != 200:
|
|
||||||
logger.error(f"e621 API Error: {resp.status}")
|
|
||||||
await message.reply("Не удалось получить картинку от сервера :(")
|
|
||||||
return
|
|
||||||
data = await resp.json()
|
|
||||||
|
|
||||||
posts = data.get("posts", [])
|
|
||||||
if not posts:
|
|
||||||
await message.reply("Ничего не найдено по этим тегам :(")
|
|
||||||
return
|
|
||||||
|
|
||||||
post = posts[0]
|
|
||||||
file_url = post.get("file", {}).get("url")
|
|
||||||
if not file_url:
|
|
||||||
await message.reply("У найденного поста нет прямого URL изображения :(")
|
|
||||||
return
|
|
||||||
|
|
||||||
await message.answer_photo(photo=types.URLInputFile(file_url), caption="Ня :3")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logger.exception("Error in uwu command")
|
|
||||||
await message.reply("Произошла ошибка при обращении к API :(")
|
|
||||||
3
main.py
3
main.py
|
|
@ -22,7 +22,6 @@ from aiogram.client.default import DefaultBotProperties
|
||||||
from AI.talk_handler import handle_talk, generate_autoreply, push_message
|
from AI.talk_handler import handle_talk, generate_autoreply, push_message
|
||||||
from games.casino import play_casino
|
from games.casino import play_casino
|
||||||
from games.fortune import generate_fortune
|
from games.fortune import generate_fortune
|
||||||
from games.uwu import handle_uwu_cmd
|
|
||||||
from games.betting import (
|
from games.betting import (
|
||||||
clear_user_sport_context,
|
clear_user_sport_context,
|
||||||
describe_match_outcomes,
|
describe_match_outcomes,
|
||||||
|
|
@ -1368,7 +1367,6 @@ def main():
|
||||||
dp.message.register(handle_bet_cmd, Command("bet"))
|
dp.message.register(handle_bet_cmd, Command("bet"))
|
||||||
dp.message.register(handle_mybets_cmd, Command("mybets"))
|
dp.message.register(handle_mybets_cmd, Command("mybets"))
|
||||||
dp.message.register(handle_gen_mem, Command("gen_mem"))
|
dp.message.register(handle_gen_mem, Command("gen_mem"))
|
||||||
dp.message.register(handle_uwu_cmd, Command("uwu"))
|
|
||||||
dp.message.register(handle_keywords, F.text)
|
dp.message.register(handle_keywords, F.text)
|
||||||
|
|
||||||
async def on_startup(bot: Bot):
|
async def on_startup(bot: Bot):
|
||||||
|
|
@ -1395,7 +1393,6 @@ def main():
|
||||||
BotCommand(command="bet", description="поставить см на матч"),
|
BotCommand(command="bet", description="поставить см на матч"),
|
||||||
BotCommand(command="mybets", description="мои ставки"),
|
BotCommand(command="mybets", description="мои ставки"),
|
||||||
BotCommand(command="svodka", description="СВО: итоги"),
|
BotCommand(command="svodka", description="СВО: итоги"),
|
||||||
BotCommand(command="uwu", description="Случайная картинка с e621"),
|
|
||||||
]
|
]
|
||||||
scopes = (
|
scopes = (
|
||||||
BotCommandScopeDefault(),
|
BotCommandScopeDefault(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue