Update README and add examples: dibs.toml and custom plugin template.

This commit is contained in:
Overlord committed 2026-10-14 18:36:51 +02:00
1 parent 58791c0f97
commit 7b00867e2c
3 files changed
+714 -2

No files matched your search

+79
View File
@@ -0,0 +1,79 @@
# An example dibs.toml. Lines starting with # are comments; dibs ignores them.
#
# Replace everything in <angle brackets> with your own, such as <id> with the
# product number from an Amazon address (https://www.amazon.de/dp/B0HMX2FSTF
# has the id B0HMX2FSTF). `dibs config validate --config dibs.toml` checks the
# file for you.
# ── What to watch ────────────────────────────────────────────────────────────
#
# Each [[item]] block is one thing you want. It can have several URLs, such as
# the same product on different Amazon sites. dibs alerts you when any of
# them can be bought.
[[item]]
name = "<name>" # any name you like; it shows up in alerts
shop = "amazon" # which plugin reads the page; amazon is built in
urls = [ # the product pages
"https://www.amazon.de/dp/<id>",
"https://www.amazon.co.uk/dp/<id>",
]
max_price = 129.99 # optional: only alert at this price or below
currency = "EUR" # optional: the currency of max_price; other
# currencies are converted at the day's rate
fx_margin = 0.05 # optional: add 5% to converted prices, for
# card fees, before comparing with max_price
seller = "fulfilled" # "first_party": sold by Amazon itself
# "fulfilled": also other sellers, if Amazon ships (the default)
# "any": every seller
interval = "3m" # how often to check each URL; at least "60s"
# A second item only needs a name, a shop and a URL. Remove the # in front of
# each line to use it:
#
# [[item]]
# name = "<another name>"
# shop = "amazon"
# urls = ["https://www.amazon.de/dp/<another id>"]
# ── How to tell you ──────────────────────────────────────────────────────────
[notify]
desktop = true # a notification on this computer (the default)
cooldown = "30m" # after an alert, stay quiet about the item for
# this long, unless the price drops
# Alerts on your phone or in Discord. Remove the # in front of the lines you
# want; the README explains where to get the addresses.
#
# webhooks = [
# { url = "https://ntfy.sh/<your-topic>", format = "ntfy" },
# { url = "https://discord.com/api/webhooks/<id>/<token>", format = "discord" },
# ]
# ── Your shop account (optional) ─────────────────────────────────────────────
#
# Without this, alerts carry a link that puts the item in your cart when you
# open it. With cart_mode = "session", dibs signs in to your account and puts
# the item in the cart itself. Read about the risks in the README first.
#
# [accounts.amazon]
# cart_mode = "session"
#
# Only if dibs should sign in by itself, rather than you with
# `dibs login amazon --browser`:
#
# username = "<email>"
# password_env = "DIBS_AMAZON_PASS" # the variable holding your password
# twofa = true # if Amazon asks you for a code
# ── Your own plugins (optional) ──────────────────────────────────────────────
#
# For shops dibs has no plugin for. The path is relative to this file.
#
# [plugins]
# <name> = "<name>.lua"
+39
View File
@@ -0,0 +1,39 @@
-- An example plugin for a made-up shop at www.example-shop.com.
--
-- To watch a shop dibs has no plugin for, copy this file next to your
-- dibs.toml, change the name and the CSS selectors to fit the shop's product
-- pages, and list it in dibs.toml:
--
-- [plugins]
-- exampleshop = "exampleshop.lua"
--
-- Then try it on a real product page with:
--
-- dibs check https://www.example-shop.com/p/12345
return {
-- The name items use as `shop = "exampleshop"`.
name = "exampleshop",
-- Which URLs this plugin is for.
matches = function(url)
return url:match("^https://www%.example%-shop%.com/") ~= nil
end,
-- Reads a product page. doc is the page, url is its address.
parse = function(doc, url)
-- parse_price understands "1.299,99 €", "£1,299.99" and the like.
local price, currency = parse_price(doc:text(".product-price"))
local sold_out = contains_any(doc:text(".stock-status"), { "sold out", "ausverkauft", "épuisé" })
return {
title = doc:text("h1"),
available = doc:exists("button.add-to-cart") and not sold_out,
price = price,
currency = currency or "EUR",
-- The shop sells everything itself, so no seller needs checking.
seller = "first_party",
}
end,
}