GithubHelp home page GithubHelp logo

davidbots247 / java-twirk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gikkman/java-twirk

0.0 0.0 0.0 221 KB

Small, basic library for communication via the Twitch chat. Java 8 compatible

License: MIT License

Java 100.00%

java-twirk's Introduction

Java-Twirk

You can contact us via the Discord Server

Small, library for creating an IRC connection to the Twitch chat.

The library is intended to make communication via Twitch chat as easy as possible, and uses Java objects to represent most events that can occur in Twitch chat.

Java 8 compatible.

Installation

Include the following in your pom.xml

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.github.gikkman</groupId>
	<artifactId>Java-Twirk</artifactId>
	<version>0.5</version>
    </dependency>
</dependencies>

Or simply download the latest version of the library jar from the release page.

Changes

There has been some new features in version 0.5, but nothing that is breaking backwards compability. New features include:

  • Whispers (This was removed in 0.4, but is now back. Twitch said they'd remove it , but they haven't so far so...)
  • Support for new sub-streak logic
  • Updated the example
  • Added even more tests
  • Touched up on some JavaDoc

And probably some more...

Usage

Basic usage

  final Twirk twirk = new TwirkBuilder(channel, SETTINGS.MY_NICK, SETTINGS.MY_PASS).build();
  twirk.connect();
  ...
  twirk.close();

Events

All events which can be reacted to are listed in TwirkListener.java This snippet will make your bot respond to any channel message with a "pong USER_NAME".

  twirk.addIrcListener( new TwirkListener() { 
    public void onPrivMsg( TwitchUser sender, TwitchMessage message) {
      twirk.channelMessage("pong " + sender.getDisplayName() );
    }
  } );

For a more complex example, which shows how to connect properly and how to write simple bot commands, check out the example code in src/example/java

Extendable

You can make Twirk use your own implementation of all event types by using custom builder classes. By extending the types Builder interface, and then passing an instance of your custom builder to the TwirkBuilder, you can use your own custom implementation of whichever type you want.

  final Twirk twirk = new TwirkBuilder(channel, SETTINGS.MY_NICK, SETTINGS.MY_PASS)
    .setClearChatBuilder( new MyClearChatBuilder() )
    .build();

This will make the Twirk instance build instances of your custom implementation of ClearChat events

Contribute

If you find any issues, or have suggestions for features (which does not clutter the library), feel free to submit an Issue or make a pull request. You can also reach me on Twitter or on Twitch

License

This library is licensed under the MIT License. If you use it, a link to this GitHub page is also greatly appriciated, if possible :)

java-twirk's People

Contributors

gikkman avatar doc94 avatar mrhighside avatar nihaals avatar

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.