AlexMog / CurseLib

CurseLib is a library to interact with CurseVoice tchat and REST APIs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CurseLib

CurseLib is a library to interact with CurseVoice tchat and REST APIs.

Getting started

First of all, you will need to compile the sources of the library.

Clone this repository and use maven to compile sources.

Prerequisites:
  • Java 1.7
  • Maven 3.0.5

Build the project by using the following command (with tests):

$ mvn clean install

If you want to have a quicker build, you can avoid the tests:

$ mvn clean install -DskipITs

Example

Here is an example of usage of the library:

CurseClient client = new CurseClient("USER", "PASSWORD");
client.authenticate();
client.connectWS();

client.addListener(new ClientListener() {
    
    public void onOpen(ServerHandshake handshakedata) {
        System.out.println("I am connected to the tchat!");
    }
    
    public void onMessage(MessageEvent event) {
        System.out.println("New message received from @"
            + event.getMessage().getSender().getUsername() + ": " + event.getMessage().getText());
    }
    
    public void onError(Exception ex) {
        System.out.println("Error catched :(, but the client will still run.");
        ex.printStackTrace();
    }
    
    public void onClose(int code, String reason, boolean remote) {
        System.out.println("Connection closed " + (remote ? "by the server" : "") + ": (" + code + ")" + reason);
    }
});

About

CurseLib is a library to interact with CurseVoice tchat and REST APIs.

License:MIT License


Languages

Language:Java 100.0%