diff --git a/examples/discord/config/__init__.py b/examples/discord/config/__init__.py new file mode 100644 index 0000000..2031e3a --- /dev/null +++ b/examples/discord/config/__init__.py @@ -0,0 +1,26 @@ +from model import Search, Parameters +import lbc + +from .handler import handle + +location = lbc.City( + lat=48.85994982004764, + lng=2.33801967847424, + radius=10_000, # 10 km + city="Paris" +) + +CONFIG = [ + Search( + name="Location Paris", + parameters=Parameters( + text="maison", + locations=[location], + category=lbc.Category.IMMOBILIER, + square=[200, 400], + price=[300_000, 700_000] + ), + delay=60 * 5, # Check every 5 minutes + handler=handle + ), +] \ No newline at end of file diff --git a/examples/discord.py b/examples/discord/config/handler.py similarity index 92% rename from examples/discord.py rename to examples/discord/config/handler.py index 65969c3..8fbca5b 100644 --- a/examples/discord.py +++ b/examples/discord/config/handler.py @@ -13,7 +13,7 @@ def handle(ad: lbc.Ad, search_name: str) -> None: "embeds": [ { "title": ad.title, - "description": f"```{ad.body}```", + "description": f"```{ad.body[:4087]}...```" if len(ad.body) >= 4090 else f"```{ad.body[:4090]}```", "url": ad.url, "color": 14381568, "author": { diff --git a/examples/discord/requirements.txt b/examples/discord/requirements.txt new file mode 100644 index 0000000..ef487e0 --- /dev/null +++ b/examples/discord/requirements.txt @@ -0,0 +1 @@ +requests==2.32.3 \ No newline at end of file