-
Notifications
You must be signed in to change notification settings - Fork 63
feat: Add message command to send direct messages #632
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #632 +/- ##
==========================================
- Coverage 79.56% 78.14% -1.43%
==========================================
Files 20 21 +1
Lines 1860 1908 +48
Branches 370 372 +2
==========================================
+ Hits 1480 1491 +11
- Misses 243 280 +37
Partials 137 137
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…handling and conversation fetching
feat: Enhance Messenger and WebScrapingMixin to support user profile …
…gument parsing and validation
1cu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required before merge:
- Fix linting errors
- Remove German comments and variables
- Remove commented-out code
- Add tests
- Add proper docstrings
Strongly recommended
- Improve error handling and messages
- Fix type annotations
- Extract command setup logic
| await self.create_browser_session() | ||
| await self.login() | ||
| await self.download_ads() | ||
| case "message": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds quite a lot of new statements and the linter is failing cause of too many statements. Do avoid a larger refactor of the commands you could use a new method to handle the commands in this case. I'm unsure - what do you think @Heavenfighter ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also unsure about the command structure.
| LOG:Final[loggers.Logger] = loggers.get_logger(__name__) | ||
|
|
||
|
|
||
| class Messenger(WebScrapingMixin): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretty low test coverage for this one. Please add tests for send_message_to_listing(), fetch_conversation() and fetch_conversation()
| # public API | ||
| # --------------------------- | ||
| async def send_message_to_listing(self, listing_url:str, message_text:str) -> bool: | ||
| # LOG.info(i18n.gettext("Opening ad page: %s"), listing_url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's not used - remove it
| # LOG.info(i18n.gettext("Opening ad page: %s"), listing_url) | ||
| await self.web_open(listing_url, timeout = 15_000) | ||
|
|
||
| # Kleiner Scroll, damit „Kontakt“-Button gerendert ist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English please
| send_btn_candidates, desc = "send message button", timeout = 6 | ||
| ) | ||
|
|
||
| # 4) kurze Heuristik/Abschluss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English please
| case "message": | ||
| self.configure_file_logging() | ||
| self.load_config() | ||
| # Optional, wie bei anderen Commands: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
English please.
| LOG.info("DONE: Message could not be confirmed.") | ||
| LOG.info("############################################") | ||
|
|
||
| case "fetch-conversations": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All commands have a similar setup - could be extracted to common setup logic.
| (By.TAG_NAME, "textarea"), | ||
| ] | ||
| textarea = await self._try_find( | ||
| textarea_candidates, desc = "message textarea", timeout = 8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several magic numbers that should be constants and explained.
| ), | ||
| ] | ||
| await self._try_click( | ||
| open_btn_candidates, desc = "message open button", timeout = 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several magic numbers that should be constants and explained.
| import urllib.parse as urllib_parse | ||
| from gettext import gettext as _ | ||
| from typing import Any, Final | ||
| from typing import Any, Dict, Final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use dict
|
This PR lacks any summary or explanation in the summary... |
|
I'm unsure about the purpose of the extension. The bot is mainly supposed to post/update ads. |
ℹ️ Description
Provide a concise summary of the changes introduced in this pull request.
📋 Changes Summary
Bullet-point key changes introduced.
Mention any dependencies, configuration changes, or additional requirements introduced.
⚙️ Type of Change
Select the type(s) of change(s) included in this pull request:
✅ Checklist
Before requesting a review, confirm the following:
pdm run test).pdm run format).pdm run lint).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.