restrict prompting to myself
This commit is contained in:
parent
2bb1e2dccb
commit
aa1fb245f5
2 changed files with 6 additions and 2 deletions
6
bot.py
6
bot.py
|
@ -3,7 +3,7 @@ from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, Messa
|
|||
CallbackContext, CallbackQueryHandler
|
||||
import logging
|
||||
|
||||
from tgbot.config import TOKEN
|
||||
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
|
||||
from tgbot.shit.render import render_text_on_image, image_to_string
|
||||
|
@ -23,7 +23,7 @@ async def start(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|||
|
||||
async def handle_text(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
|
||||
if not update.message.text.startswith("prompting"):
|
||||
if not update.message.text.startswith("prompting") or update.message.from_user["username"] not in PROMPTING_USERS:
|
||||
file = render_text_on_image("tgbot/assets/red_ebalo.png", update.message.text)
|
||||
await context.bot.send_sticker(chat_id=update.effective_chat.id, sticker=file)
|
||||
else:
|
||||
|
@ -57,6 +57,7 @@ async def callback_query_handler(update: Update, context: CallbackContext):
|
|||
else:
|
||||
await query.answer()
|
||||
|
||||
|
||||
async def handle_inline(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
query = update.inline_query.query
|
||||
if not query:
|
||||
|
@ -76,6 +77,7 @@ async def handle_inline(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|||
|
||||
await handle_red_ebalo(update, context)
|
||||
|
||||
|
||||
def main():
|
||||
application = ApplicationBuilder().token(TOKEN).build()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue