Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github Greeting #18

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |
👋 Thank you for raising an issue! We appreciate your effort in helping us improve.
Our team will review it shortly. Stay tuned!
👋 Thank you for raising an issue! We appreciate your effort in helping us improve.
Our team will review it shortly. Stay tuned for updates!
pr-message: |
🎉 Thank you for your contribution! Your pull request has been submitted successfully.
A maintainer will review it as soon as possible. We appreciate your support in making this project better!
🎉 Thank you for your contribution! Your pull request has been submitted successfully.
A maintainer will review it as soon as possible. We appreciate your support in improving this project!
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