• 25-02-2024, 00:08:27
    #1
    arkadaşlar merhaba python telegram da bot geliştirmeye çalışıyorum takıldığım kısım var benim yapmak istediğim konuşma botu gibi bişe sorucak mesela -adın ne - ali bot burda merhaba ali dicek yani yazdığı mesaja ben geri döndüğümde onu alacak

    from telegram import Update
    from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
    from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
    
    
    app = ApplicationBuilder().token("token").build()
    app.add_handler(CommandHandler("Start", hello))
    
    async def hello(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
        await update.message.reply_text(f'merhaba adını gir') 
    
    bu kısımda benim verdiğim cevabı ekrana bastırsın
    
    app.run_polling()
  • 25-02-2024, 00:13:02
    #2
    denermisinz hocam

    from telegram import Update
    from telegram.ext import Application, CommandHandler, MessageHandler, Filters, Context
    
    app = Application().token("token").build()
    
    async def hello(update: Update, context: Context) -> None:
        await update.message.reply_text('Merhaba! Adınızı girin.')
    
    async def get_name(update: Update, context: Context) -> None:
        user_message = update.message.text
        print("isim:", user_message)
    
    app.add_handler(CommandHandler("start", hello))
    app.add_handler(MessageHandler(Filters.text & ~Filters.command, get_name))
    
    app.run_polling()