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
120
pub points
0%
popularity

Publisher

verified publisherjanderedev.xyz

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

eventify, http, web_socket_channel

More

Packages that depend on dartvolt