Skip to content

Commit

Permalink
change response on the start message
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-Solder committed Jul 16, 2024
1 parent d0a621d commit adbc06e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions backend/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update, WebAppInfo
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler, CallbackQueryHandler
from telegram.ext import ApplicationBuilder, ContextTypes, CommandHandler
import os
from dotenv import load_dotenv

Expand All @@ -13,25 +13,33 @@
load_dotenv()

TOKEN = os.getenv('TELEGRAM_TOKEN')
WEB_APP_URL = os.getenv('WEB_APP_URL')


async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Sends a message with three inline buttons attached."""
"""Sends a photo with an inline button attached from local directory."""

keyboard = [[
InlineKeyboardButton("Let's GO!", web_app=WebAppInfo(url="https://ghost-solder.github.io/TLingua/"))
InlineKeyboardButton("Let's GO!", web_app=WebAppInfo(url=WEB_APP_URL))
]]

reply_markup = InlineKeyboardMarkup(keyboard)

await update.message.reply_text("Let's GO!", reply_markup=reply_markup)
photo_path = 'images/start-message.png'

with open(photo_path, 'rb') as photo_file:
await context.bot.send_photo(
chat_id=update.effective_chat.id,
photo=photo_file,
caption='Welcome to TLingua! 🎉🎉🎉\n\nAre you ready for a completely new language experience? 🥳',
reply_markup=reply_markup,
)


if __name__ == '__main__':
application = ApplicationBuilder().token(TOKEN).build()

application.add_handler(CommandHandler("start", start))
start_handler = CommandHandler('start', start)
application.add_handler(start_handler)

# Run the bot until the user presses Ctrl-C
application.run_polling(allowed_updates=Update.ALL_TYPES)

Binary file added backend/images/start-message.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit adbc06e

Please sign in to comment.