add fedi posts to xitter links fixer

This commit is contained in:
Owl 2025-04-09 00:15:11 +07:00
parent 539c4c0b55
commit c0bb569eca
2 changed files with 145 additions and 0 deletions

7
bot.py
View file

@ -3,6 +3,7 @@ from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, Messa
CallbackContext, CallbackQueryHandler
import logging
from fed import build_fediverse_inline_results, extract_content
from tgbot.config import TOKEN, PROMPTING_USERS
from tgbot.shit.handlers import handle_xitter, handle_red_ebalo, handle_hentai, handle_cute_button
from tgbot.shit.prompting import gen_image
@ -63,6 +64,12 @@ async def handle_inline(update: Update, context: ContextTypes.DEFAULT_TYPE):
if not query:
return
if query.lower().startswith("fed"):
post_data = extract_content(query.replace("fed", "").strip())
results = build_fediverse_inline_results(post_data)
await update.inline_query.answer(results, cache_time=0, is_personal=True)
return
if "https://x.com" in query:
await handle_xitter(update, context)
return