#roblox-api #roblox #api-bindings #api

roboat

Roblox API 的高性能接口

60 个版本 (35 个版本有破坏性)

0.35.0 2024年7月17日
0.34.2 2023年11月25日
0.33.1 2024年5月14日
0.33.0 2023年6月9日
0.0.1 2023年3月31日

#24 in 游戏

Download history 216/week @ 2024-05-10 273/week @ 2024-05-17 59/week @ 2024-05-24 9/week @ 2024-05-31 3/week @ 2024-06-07 3/week @ 2024-07-05 110/week @ 2024-07-12 24/week @ 2024-07-19 3/week @ 2024-07-26 1/week @ 2024-08-02

每月下载 138 次
用于 classics-ranking-bot

MIT 许可证

245KB
3.5K SLoC

Crates.io Documentation dependency status

roboat

roboat logo

Roblox API 的高性能接口。

此库旨在具有高性能,这意味着它支持代理并且能够并行发出请求。

请注意,此软件包仍处于早期开发阶段,直到发布第一个主要版本之前,更新可能会破坏。

文档

在此软件包中使用了广泛的文档。此软件包中所有公共方法都有文档,并至少有一个相应的示例。

文档可以在 这里 找到。

覆盖率

设置

您可以通过运行以下命令将roboat的最新版本添加到您的项目中:

cargo add roboat

快速入门示例

示例 1 - 购买免费UGC限制

此代码片段允许您购买免费UGC限制。

通过更改价格,可以修改为购买非免费UGC限制。

// Replace this value with your own roblosecurity token.
const ROBLOSECURITY: &str = "your-roblosecurity-token";
// Replace this value with the item id of the item you want to purchase.
const ITEM_ID: u64 = 13119979433;
// Replace this value if you want to purchase a non-free item.
const PRICE: u64 = 0;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = roboat::ClientBuilder::new()
        .roblosecurity(ROBLOSECURITY.to_string())
        .build();

    let collectible_item_id = client.collectible_item_id(ITEM_ID).await?;

    let collectible_product_id = client
        .collectible_product_id(collectible_item_id.clone())
        .await?;

    let collectible_creator_id = client
        .collectible_creator_id(collectible_item_id.clone())
        .await?;

    client
        .purchase_non_tradable_limited(
            collectible_item_id,
            collectible_product_id,
            collectible_creator_id,
            PRICE,
        )
        .await?;

    println!("Purchased item {} for {} robux!", ITEM_ID, PRICE);

    Ok(())
}

示例 2 - 获取用户信息

此代码片段允许您获取您的当前robux、id、用户名和显示名。

// Replace this value with your own roblosecurity token.
const ROBLOSECURITY: &str = "your-roblosecurity-token";

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = roboat::ClientBuilder::new()
        .roblosecurity(ROBLOSECURITY.to_string())
        .build();

    let robux = client.robux().await?;
    let user_id = client.user_id().await?;
    let username = client.username().await?;
    let display_name = client.display_name().await?;

    println!("Robux: {}", robux);
    println!("User ID: {}", user_id);
    println!("Username: {}", username);
    println!("Display Name: {}", display_name);

    Ok(())
}

示例 3 - 获取可交易限量商品的价格

此代码片段允许您通过获取转售列表来查看可交易限量商品最低价格。

// Replace this value with your own roblosecurity token.
const ROBLOSECURITY: &str = "your-roblosecurity-token";

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = roboat::ClientBuilder::new()
        .roblosecurity(ROBLOSECURITY.to_string())
        .build();

    let item_id = 1365767;
    let limit = roboat::Limit::Ten;
    let cursor = None;

    let (resellers, _) = client.resellers(item_id, limit, cursor).await?;

    println!("Lowest Price for Valkyrie Helm: {}", resellers[0].price);

    Ok(())
}

示例 4 - 获取商品详情

此代码片段允许您获取商品的详细信息。

use roboat::catalog::avatar_catalog::{ItemArgs, ItemType};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = roboat::ClientBuilder::new().build();

    let item = ItemArgs {
        item_type: ItemType::Asset,
        id: 1365767,
    };

    let details = &client.item_details(vec![item]).await?[0];

    let name = &details.name;
    let description = &details.description;
    let creator_name = &details.creator_name;
    let price = details.price.unwrap_or(0);

    println!("Name: {}", name);
    println!("Description: {}", description);
    println!("Creator Name: {}", creator_name);
    println!("Price: {}", price);

    Ok(())
}

更多示例

更多示例可以在examples目录中找到。

相关Crates

此crate是roli的姐妹crate,roli是Rolimons.com的API包装器。

请求

未看到您需要的端点?请在issue中请求或在Discord服务器中提到它!由于Roblox有很多端点,我们发现按需添加端点更容易。

贡献

欢迎Pull请求和issue!

请参阅CONVENTIONS.md以获取有关此crate中使用的约定的信息。

用于制作此crate的附加资源可在RESOURCES.md中找到。

许可

MIT许可

依赖项

~7–19MB
~286K SLoC