Git Product home page Git Product logo

jrv's Introduction

The Java Revolt Bridge

The first Java client library for interacting with the Revolt chat platform.

The Java Revolt Bridge on Revolt

There is a Revolt server: https://app.revolt.chat/invite/2V2v0hzN

Documentation

See the documentation at javadoc.io or inline in your favorite IDE.

Usage

You can see usage instructions and the current version on The Central Repository.

Gradle

// Groovy DSL
implementation "ga.geist:jrv:[current version]"

// Kotlin
implementation("ga.geist:jrv:[current version]")

Maven

<dependency>
  <groupId>ga.geist</groupId>
  <artifactId>jrv</artifactId>
  <version>[current version]</version>
</dependency>

SBT

libraryDependencies += "ga.geist" % "jrv" % "[current version]"

Example Application

This is a very simple example application implemented in Java. It replies to any message with the content "?jrv" with "The Java Revolt Bridge".

import ga.geist.jrv.RevoltBridge;
import ga.geist.jrv.RevoltEventListener;
import ga.geist.jrv.auth.AuthStrategy;
import ga.geist.jrv.auth.BotToken;
import ga.geist.jrv.events.*;

import java.net.URI;
import java.net.URISyntaxException;

public class App {
    public static class EventManager extends RevoltEventListener {
        @Override
        public void onEvent(Event event, RevoltBridge bridge) {
            if (event instanceof WSOpenEvent) {
                AuthStrategy auth = new BotToken(System.getenv("REVOLT_TOKEN"));
                bridge.authenticate(auth);
            } else if (event instanceof WSErrorEvent) {
                ((WSErrorEvent)event).getException().printStackTrace();
            } else if (event instanceof MessageEvent) {
                MessageEvent msg = (MessageEvent)event;

                if (msg.getMessage().getContent().equals("?jrv")) {
                    msg.getMessage().getChannel().sendMessage("The Java Revolt Bridge");
                }
            }
        }
    }

    public static void main(String[] args) throws URISyntaxException {
        RevoltBridge jrv = new RevoltBridge(new URI("https://api.revolt.chat"));

        jrv.registerEventListener(new EventManager());
    }
}

The Library in Use

You can see this library in use at Unofficial REVOLT for Fabric (source code repository).

Warning

This is a brand-new, highly experimental client library. The API can change any time, in hopes to provide a stable and highly polished API in the future. Be sure to read the changelogs for any breaking changes every time you upgrade the library!

jrv's People

Contributors

infi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jrv's Issues

Small QOL change

I think this lib can profit from this minor QOL change, which would be to offer a RevoltBridge constructor without any required argument.

This Contructor would use the default https://api.revolt.chat API URI to connect.

Again, a minor change but still somewhat good to have.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.