Yurba.js Documentation
    Preparing search index...

    Module @yurbajs/rest


    yurba.js logo


    npm version npm downloads Last commit npm last update

    REST client for Yurba API with full TypeScript support.

    WARNING: it's alpha version

    Node.js 20 or newer is required.

    npm install @yurbajs/rest
    yarn add @yurbajs/rest
    pnpm add @yurbajs/rest
    bun add @yurbajs/rest
    import { REST } from '@yurbajs/rest';

    const api = new REST('TOKEN');

    try {
    // Get user info
    const user = await api.users.getMe();
    console.log('Bot user:', user);

    // Send message (dialogid)
    try {
    const message = await api.messages.send(1111, 'Hello, world!');
    console.log('Message sent:', message);
    } catch (error) {
    console.error('Failed to send message:', error.message);
    }

    // Get user by tag (@)
    try {
    const targetUser = await api.users.getByTag('rastgame');
    console.log('User:', targetUser);
    } catch (error) {
    console.error('Failed to get user:', error.message);
    }
    } catch (error) {
    console.error('Failed to get bot info:', error.message);
    }

    Want to help make yurba.js better?

    Please make sure to follow our coding style and test your changes before submitting.

    Need assistance?

    Classes

    ApiError
    AuthResource
    DialogResource
    MediaResource
    MessageResource
    PostResource
    REST
    UserResource

    Interfaces

    RateLimitConfig
    RequestConfig
    RestClientOptions

    References

    default → REST