dartvolt 0.0.5 copy "dartvolt: ^0.0.5" to clipboard
dartvolt: ^0.0.5 copied to clipboard

Experimental API Wrapper for the REVOLT.chat API including basic HTTP and Websocket functionality.

example/example.dart

import 'package:dartvolt/dartvolt.dart' as dartvolt;

void main() {
    var client = dartvolt.Client(dartvolt.ClientConfig(
        apiUrl: 'https://api.revolt.chat',
        debug: true
    ));

    // Use existing session credentials.
    // You can use client.login() in the
    // future to create a new session, but
    // this isn't properly implemented right now. 
    client.useExistingSession(dartvolt.SessionInfo(
        clientId: 'My very epic 26 letter User ID',
        sessionId: 'My equally epic 26 letter Session ID',
        sessionToken: 'My super epic 64 letter Session Secret'
    ));

    // Listen for the ready event.
    // Will probably change in the future.
    client.events.on('ready', null, (ev, context) {
        print('My super epic client logged in!');
    });

    // Reply to messages starting with `!test`
    client.events.on('message/create', null, (evt, context) {
        var message = (evt.eventData as dartvolt.Message);
        
        if ((message.content ?? '').startsWith('!test')) {
            message.channel.send('Dartvolt is yes!');
        }
    });
}
4
likes
130
points
29
downloads

Publisher

verified publisherjanderedev.xyz

Weekly Downloads

Experimental API Wrapper for the REVOLT.chat API including basic HTTP and Websocket functionality.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

eventify, http, web_socket_channel

More

Packages that depend on dartvolt