-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.ts
More file actions
23 lines (19 loc) · 792 Bytes
/
Example.ts
File metadata and controls
23 lines (19 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import Client from "./mod.ts";
let Locale = (Deno.args[0] ?? 'en-gb') as 'en-gb' | 'en-us'; // from argument 1
let Dev = Deno.args.includes('--dev');
let Loop = Deno.args.includes('--loop');
let isKnown = false
let rtxClient = new Client(
{
Locale,
Dev,
WebhookUrl : "Your webhook",
GPU: "3080",
OnFail: () => console.log("nooo it failed!"),
OnInStock: (prod) => { if (!isKnown) rtxClient.AlertWebhook(prod, `${ prod.displayName } is now in stock.`); isKnown = true },
OnOutStock: (prod) => { if (isKnown) rtxClient.AlertWebhook(prod, `${ prod.displayName } is now out of stock.` ); isKnown = false },
}
);
await rtxClient.Check();
if (!Loop) Deno.exit(1);
else setInterval(rtxClient.Check.bind(rtxClient), 10e3);