added step and updated some messages

pull/231/head
Yariv Menachem 2025-01-06 16:18:18 +02:00
parent 6e841ffc22
commit 9032949c0c
3 changed files with 17 additions and 12 deletions

View File

@ -10,6 +10,7 @@ class User(BaseModel):
username: str
chat_id: Union[int, str] = None
experience: Union[int, str] = None
job_age: Union[int, str] = None
position: Optional[Position] = None
cities: Optional[list[str]] = None
title_filters: Optional[list[str]] = None
@ -20,8 +21,10 @@ class User(BaseModel):
message += f"Username: @{self.username}\n"
if self.chat_id:
message += f"Chat ID: {self.chat_id}\n"
if self.job_age:
message += f"Job Age (Hours): {self.experience}\n"
if self.experience:
message += f"Experience: {self.experience}\n"
message += f"Experience(Years): {self.experience}\n"
if self.position:
message += f"Position Level: {self.position.value}\n"
if self.cities:

View File

@ -26,16 +26,17 @@ JOB_AGE_MESSAGE: str = "How recent should the jobs be? ⏰\n" \
JOB_AGE_INVALID: str = "Oops! Please enter a number for the number of hours. 😕\n" \
"For example, 24, 48, or 168."
FILTER_TILE_MESSAGE: str = "To help me narrow down your search, tell me about any relevant tags or keywords.\n" \
"For example: 'remote', 'entry-level', 'python', 'machine learning', 'QA'.\n\n" + multi_value_message
FILTER_TILE_MESSAGE: str = "To help me narrow down your search, tell me about any NOT relevant tags or keywords.\n" \
"For example: 'remote', 'BI', 'python', 'machine learning', 'QA'.\n\n" + multi_value_message
THANK_YOU_MESSAGE: str = "Thank you for chatting with JobSeeker Bot!\n\n" \
"I can help you find jobs on LinkedIn, Glassdoor, and more."
SEARCH_MESSAGE: str = "To search for jobs on a specific site, simply send the site name:\n" \
"/linkedin\n" \
"/indeed\n" \
"/glassdoor\n" \
"/google\n\n" \
"/goozali\n\n" \
"Or, use the command /find to search across all supported job boards for a broader search.\n\n" \
"Let me know how I can assist you further! 😊"

View File

@ -7,14 +7,14 @@ from telegram.ext import (
)
from config.cache_manager import cache_manager
from scrapers.utils import create_logger
from model.Position import Position
from model.User import User
from model.user_repository import user_repository
from scrapers.utils import create_logger
from telegram_bot import TelegramBot
from telegram_handler.start_handler_constats import START_MESSAGE, POSITION_MESSAGE, POSITION_NOT_FOUND, \
LOCATION_MESSAGE, EXPERIENCE_MESSAGE, FILTER_TILE_MESSAGE, THANK_YOU_MESSAGE, BYE_MESSAGE, VERIFY_MESSAGE, \
SEARCH_MESSAGE, EXPERIENCE_INVALID
SEARCH_MESSAGE, EXPERIENCE_INVALID, JOB_AGE_INVALID, JOB_AGE_MESSAGE
class Flow(Enum):
@ -123,8 +123,7 @@ class TelegramStartHandler:
cached_user: User = cache_manager.find(update.message.from_user.username)
cached_user.experience = update.message.text
cache_manager.save(cached_user.username, cached_user)
await update.message.reply_text(
FILTER_TILE_MESSAGE)
await update.message.reply_text(JOB_AGE_MESSAGE)
return Flow.JOB_AGE.value
async def job_age(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> int:
@ -135,13 +134,13 @@ class TelegramStartHandler:
if not update.message.text.isnumeric():
await update.message.set_reaction(ReactionEmoji.PILE_OF_POO)
await update.message.reply_text(EXPERIENCE_INVALID)
await update.message.reply_text(EXPERIENCE_MESSAGE)
await update.message.reply_text(JOB_AGE_INVALID)
await update.message.reply_text(JOB_AGE_MESSAGE)
return Flow.EXPERIENCE.value
return Flow.JOB_AGE.value
await update.message.set_reaction(ReactionEmoji.FIRE)
cached_user: User = cache_manager.find(update.message.from_user.username)
cached_user.experience = update.message.text
cached_user.job_age = update.message.text
cache_manager.save(cached_user.username, cached_user)
await update.message.reply_text(
FILTER_TILE_MESSAGE)
@ -152,6 +151,8 @@ class TelegramStartHandler:
"""Asks for a filters_flow."""
await update.message.set_reaction(ReactionEmoji.FIRE)
title_filters = update.message.text.split(",")
# Remove leading/trailing spaces from each city name
title_filters = [title_filter.strip() for title_filter in title_filters]
reply_markup = ReplyKeyboardMarkup([[KeyboardButton("Yes"), KeyboardButton("No")]], one_time_keyboard=True,
input_field_placeholder=Flow.VERIFY_FILTERS.name)
await update.message.reply_text(VERIFY_MESSAGE % title_filters, reply_markup=reply_markup)