respond.py 2.17 KB
#########################################
#   elif '멜론 1위 노래 들어봤어?' in text:
#         update.message.reply_text("잠깐 찾아볼게")
#        #update.message.reply_text("아 그 xxx 노래?")


#    elif '내일 날씨 어때?' in text:
#        update.message.reply_text("잠깐만")
#        #update.message.reply_text("잠깐만")







from telegram.ext import Updater, MessageHandler, Filters
updater = Updater(token = "1721885449:AAHDGMbjSJfhXxML6nfSCpfiU7SghpL_vOE")
updater = Updater(token = "1721885449:AAHDGMbjSJfhXxML6nfSCpfiU7SghpL_vOE", use_context=True)
dispatcher = updater.dispatcher
updater.start_polling()

#def greet_user(`update: Update, context: CallbackContext`):
def handler(update, context):   
    text = update.message.text
    chat_id = update.message.chat_id

    if "모해" in text:
        update.message.reply_text("나 낼 입을 옷 고르고 있어")

    elif 'ㅎㅎ' in text:
        update.message.reply_text("ㅎㅎ")

    elif '밥 먹었어?' == text:
        update.message.reply_text("나 아직 못 먹었어 ㅠㅠ, 진세는 밥 먹었어?")   
    elif '먹었어' == text:
        update.message.reply_text("우왕 뭐 먹었어?")    
    elif '안 먹었어' in text:
        update.message.reply_text("헐헐 어쩌다?, 같이 뭐라도 먹을래?")     
    elif '같이 먹을까?' in text:
        update.message.reply_text("웅웅 집앞으로 나와")


    elif '사랑해' in text:
        update.message.reply_text("내가 더 사랑해 ❤")

    elif '잘자' == text:
        update.message.reply_text("웅웅, 진세 너두 잘자 ㅎㅎ")



#########################################
    elif '멜론 1위 노래 들어봤어?' in text:
         update.message.reply_text("잠깐 찾아볼게")
        #update.message.reply_text("아 그 xxx 노래?")

    elif '내일 날씨 어때?' in text:
        update.message.reply_text("잠깐만")
        #update.message.reply_text("잠깐만")



    else:
        update.message.reply_text("응?")
        

echo_handler = MessageHandler(Filters.text, handler)  #업데이터를 통해서 필터된 텍스트가 """핸들러로 전달됨"""
dispatcher.add_handler(echo_handler)