-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathpurchase_tradable_limited.rs
53 lines (45 loc) · 1.26 KB
/
purchase_tradable_limited.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use clap::Parser;
use roboat::ClientBuilder;
#[derive(Parser, Debug)]
struct Args {
#[arg(long, short)]
roblosecurity: String,
#[arg(long, short)]
item_id: u64,
#[arg(long, short)]
seller_id: u64,
#[arg(long, short)]
uaid: u64,
#[arg(long, short)]
price: u64,
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = Args::parse();
let client = ClientBuilder::new()
.roblosecurity(args.roblosecurity)
.build();
let item_id = args.item_id;
let seller_id = args.seller_id;
let uaid = args.uaid;
let price = args.price;
let item_args = roboat::catalog::Item {
item_type: roboat::catalog::ItemType::Asset,
id: item_id,
};
let product_id = client
.item_details(vec![item_args])
.await?
.pop()
.unwrap()
.product_id
.expect("Item cannot be a \"new\" limited. Run purchase_ugc_limited instead.");
let result = client
.purchase_tradable_limited(product_id, seller_id, uaid, price)
.await;
match result {
Ok(()) => println!("Purchased item for {} robux.", price),
Err(e) => println!("Failed to purchase item for {} robux. Reason: {}", price, e),
}
Ok(())
}