add button
This commit is contained in:
parent
ef18f67115
commit
219e28b420
2 changed files with 42 additions and 3 deletions
|
@ -1,6 +1,9 @@
|
|||
import uuid
|
||||
|
||||
import requests
|
||||
from pybooru import Danbooru
|
||||
from telegram import Update
|
||||
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup, InlineQueryResultArticle, \
|
||||
InputTextMessageContent
|
||||
from telegram.ext import ContextTypes
|
||||
|
||||
from tgbot.config import STICKER_SHITHOLE, BOORU_API_URL, INLINE_QUERY_CACHE_SECONDS, DANBOORU_API_KEY
|
||||
|
@ -53,6 +56,21 @@ async def handle_red_ebalo(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|||
await context.bot.answer_inline_query(update.inline_query.id, results)
|
||||
|
||||
|
||||
async def handle_cute_button(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
|
||||
button = InlineKeyboardButton("Click me!", callback_data="show_cute_popup")
|
||||
keyboard = InlineKeyboardMarkup([[button]])
|
||||
|
||||
result = InlineQueryResultArticle(
|
||||
id=str(uuid.uuid4()),
|
||||
title="Cute button!",
|
||||
input_message_content=InputTextMessageContent("Here is a post with a cute button:"),
|
||||
reply_markup=keyboard
|
||||
)
|
||||
|
||||
await context.bot.answer_inline_query(update.inline_query.id, [result])
|
||||
|
||||
|
||||
async def handle_hentai(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
query = update.inline_query.query.replace("hentai", "").replace("—", "--")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue