Skip to content

Commit

Permalink
Added a /start
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufk committed Aug 10, 2024
1 parent add8fc0 commit 16da045
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ components/
training_*
context.txt
deployment.yaml
deployment_reloaded.yaml
deployment*
10 changes: 9 additions & 1 deletion jarvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,14 @@ async def chat(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
logger.debug(f"{str(update.effective_user.id)} --> {update.message.text} , Jarvis: {message}")
return CONVERSATION

async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Send a message when the command /start is issued."""
user = update.effective_user
await update.message.reply_html(
rf"Hi {str(update.effective_user.username)}!",
)


async def clear(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
"""Clear the conversation."""
if update.effective_user.id != master_id:
Expand All @@ -180,7 +188,7 @@ def main() -> None:

# Add conversation handler with the states INTRO and CONVERSATION
conv_handler = ConversationHandler(
entry_points=[MessageHandler(filters.TEXT & ~filters.COMMAND, chat)],
entry_points=[MessageHandler(filters.TEXT & ~filters.COMMAND, chat),CommandHandler("start", start)],
states={
CONVERSATION: [MessageHandler(filters.TEXT & ~filters.COMMAND, chat)],
},
Expand Down

0 comments on commit 16da045

Please sign in to comment.