diff --git a/src/main.py b/src/main.py index 99a87c1..ee57cad 100644 --- a/src/main.py +++ b/src/main.py @@ -28,23 +28,17 @@ if __name__ == "__main__": application.add_handler(CommandHandler("find", tg_handler_all.handle)) # Goozali tg_handler_goozali = TelegramDefaultHandler(sites=[Site.GOOZALI]) - application.add_handler(CommandHandler( - Site.GOOZALI.value, tg_handler_goozali.handle)) + application.add_handler(CommandHandler(Site.GOOZALI.value, tg_handler_goozali.handle)) # GlassDoor tg_handler_glassdoor = TelegramDefaultHandler(sites=[Site.GLASSDOOR]) - application.add_handler(CommandHandler( - Site.GLASSDOOR.value, tg_handler_glassdoor.handle)) + application.add_handler(CommandHandler(Site.GLASSDOOR.value, tg_handler_glassdoor.handle)) # LinkeDin tg_handler_linkedin = TelegramDefaultHandler(sites=[Site.LINKEDIN]) - application.add_handler(CommandHandler( - Site.LINKEDIN.value, tg_handler_linkedin.handle)) + application.add_handler(CommandHandler(Site.LINKEDIN.value, tg_handler_linkedin.handle)) # Indeed tg_handler_indeed = TelegramDefaultHandler(sites=[Site.INDEED]) - application.add_handler(CommandHandler( - Site.INDEED.value, tg_handler_indeed.handle)) - application.add_handler(CommandHandler( - "myInfo", my_info_handler.handle)) - application.add_handler(CallbackQueryHandler( - tg_callback_handler.button_callback)) + application.add_handler(CommandHandler(Site.INDEED.value, tg_handler_indeed.handle)) + application.add_handler(CommandHandler("myInfo", my_info_handler.handle)) + application.add_handler(CallbackQueryHandler(tg_callback_handler.button_callback)) logger.info("Run polling from telegram") application.run_polling(allowed_updates=Update.ALL_TYPES) diff --git a/src/model/User.py b/src/model/User.py index afa1019..e35bba3 100644 --- a/src/model/User.py +++ b/src/model/User.py @@ -1,6 +1,6 @@ from typing import Optional, Union -from pydantic import BaseModel, Field +from pydantic import BaseModel from model.Position import Position @@ -12,6 +12,7 @@ class User(BaseModel): experience: Union[int, str] = None job_age: Union[int, str] = None position: Optional[Position] = None + country: Optional[str] = None cities: Optional[list[str]] = None title_filters: Optional[list[str]] = None diff --git a/src/telegram_handler/start_handler_constats.py b/src/telegram_handler/start_handler_constats.py index 13e2914..f1f2898 100644 --- a/src/telegram_handler/start_handler_constats.py +++ b/src/telegram_handler/start_handler_constats.py @@ -2,7 +2,7 @@ START_MESSAGE: str = "Hi there! I'm JobSeeker Bot, your friendly job search assi "I'm here to help you find the perfect position.\n\n" \ "To stop chatting with me at any time, just send '/cancel'.\n\n" -POSITION_MESSAGE: str = "What kind of position are you looking for? ✨\n" \ +POSITION_MESSAGE: str = "What kind of position are you looking for? ✨\n\n" \ "(e.g., Software Engineer, Data Scientist, Marketing Manager)" POSITION_NOT_FOUND: str = "I couldn't find any positions matching your request. 😕\n" \ @@ -17,7 +17,7 @@ EXPERIENCE_MESSAGE: str = "How many years of professional experience do you have EXPERIENCE_INVALID: str = "Oops! Please enter your experience in years as a number.😕\n" \ "For example, 2, 5, or 10." -JOB_AGE_MESSAGE: str = "How recent should the jobs be? ⏰\n" \ +JOB_AGE_MESSAGE: str = "How recent should the jobs be? ⏰\n\n" \ "(Enter the number of hours, e.g., 24 for last 24 hours, 168 for last week)" # JOB_AGE_MESSAGE: str = "Within how many hours do you want to see jobs posted? ⏰\n" \ diff --git a/src/telegram_handler/telegram_default_handler.py b/src/telegram_handler/telegram_default_handler.py index 3980f81..0efa06a 100644 --- a/src/telegram_handler/telegram_default_handler.py +++ b/src/telegram_handler/telegram_default_handler.py @@ -53,14 +53,14 @@ class TelegramDefaultHandler(TelegramHandler): site_names = [site.name for site in self.sites_to_scrap] site_names_print = ", ".join(site_names) - # locations = [location + ", Israel" for location in user.cities] + locations = [location + f", {user.country}" for location in user.cities] await self.telegram_bot.send_text(chat_id, f"Start scarping: {site_names_print}") filtered_out_jobs, jobs = scrape_jobs( site_name=self.sites_to_scrap, user=user, search_term=user.position.value, - locations=user.cities, + locations=locations, results_wanted=200, hours_old=int(user.job_age), filter_by_title=user.title_filters, diff --git a/src/telegram_handler/telegram_start_handler.py b/src/telegram_handler/telegram_start_handler.py index b00218f..741d676 100644 --- a/src/telegram_handler/telegram_start_handler.py +++ b/src/telegram_handler/telegram_start_handler.py @@ -142,8 +142,7 @@ class TelegramStartHandler: cached_user: User = cache_manager.find(update.message.from_user.username) cached_user.job_age = update.message.text cache_manager.save(cached_user.username, cached_user) - await update.message.reply_text( - FILTER_TILE_MESSAGE) + await update.message.reply_text(FILTER_TILE_MESSAGE) return Flow.FILTERS.value