Skip to content

Commit

Permalink
fixed the bug
Browse files Browse the repository at this point in the history
  • Loading branch information
smartfellow1234 committed Sep 30, 2024
1 parent 81441a7 commit cefbeb9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def handle_response(text: str):
return 'Hey there! Type /price to check cryptocurrency prices.'
return 'I can help you check cryptocurrency prices. Type /price to start.'

# Function to greet new members
async def greet_new_member(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
for new_member in update.message.new_chat_members:
await update.message.reply_text(f"Welcome {new_member.first_name}! Enjoy using the Crypto Bot!")

# Error handling
async def error(update: Update, context: ContextTypes.DEFAULT_TYPE):
print(f"Update {update} caused error {context.error}")
Expand All @@ -73,9 +78,12 @@ async def error(update: Update, context: ContextTypes.DEFAULT_TYPE):
# Button handler
app.add_handler(CallbackQueryHandler(button))

# Message Handler
# Message Handler for incoming messages
app.add_handler(MessageHandler(filters.TEXT, handle_message))

# Message Handler for new chat members
app.add_handler(MessageHandler(filters.StatusUpdate.NEW_CHAT_MEMBERS, greet_new_member))

# Error Handler
app.add_error_handler(error)

Expand Down

0 comments on commit cefbeb9

Please sign in to comment.