Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 10 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Java-Twirk
[![](https://jitpack.io/v/Gikkman/Java-Twirk.svg)](https://jitpack.io/#Gikkman/Java-Twirk)
[![](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/Java-Twirk/Twirk#)
You can also contact us via the [Discord Server](https://discord.gg/8NXaEyV)
You can contact us via the [Discord Server](https://discord.gg/8NXaEyV)

Small, basic library for creating an IRC connection to the Twitch chat.
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.

Expand All @@ -23,25 +22,21 @@ Include the following in your pom.xml
<dependency>
<groupId>com.github.gikkman</groupId>
<artifactId>Java-Twirk</artifactId>
<version>LATEST_RELEASE_VERION_HERE</version>
<version>0.5</version>
</dependency>
</dependencies>
```
Or simply download the latest version of the library jar from the release page.

## Changes
There has beenmajor changes from Java-Twirk 0.3 to Java-Twirk 0.4. I am sorry for the hassle, but it was a necessity. Changes include (but is not limited to)
* Added support for Subscription Gift
* Added support for Raid
* Encapsulated all default factories (previously all public under GikkDefault_<NAME HERE>)
* TwirkListenerBaseImpl has been removed, please implement TwirkListener instead
* Mode-events has been depricated (please use the TwitchUser.isMod() instead)
* Subscriber-event has been removed. It is now found under Usernotice-event instead (Twitch has changed their grouping)
* USER_TYPES now has category SUBSCRIBER, which is given to regular subs and turbo subs.
* USER_TYPES now has ranks, which allows you to do if( user.getUserType().value >= USER_TYPE.SUBSCRIBER.value )
* Added the isOwner() status on TwichUser
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. Thankfully, Java is a strongly typed language :D
And probably some more...

# Usage
#### Basic usage
Expand Down
1 change: 0 additions & 1 deletion src/example/java/com/gikk/twirk/BotExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.gikk.twirk.events.TwirkListener;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

/**Simple example of how Twirk can be used. <br><br>
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/gikk/twirk/Twirk.java
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,32 @@ public final class Twirk {
public void serverMessage(String message) {
outThread.quickSend(message);
}

/**Enqueues a whisper at the end of the message queue. The whisper will
* be sent when all messages enqueued before it has been sent.
* <br>
* Be aware that too frequent use of whispers might get your bot rate
* limited.
*
* @param receiver The user that should receive the message
* @param message The message to whisper
*/
public void whisper(TwitchUser receiver, String message){
whisper(receiver.getUserName(), message);
}

/**Enqueues a whisper at the end of the message queue. The whisper will
* be sent when all messages enqueued before it has been sent.
* <br>
* Be aware that too frequent use of whispers might get your bot rate
* limited.
*
* @param userName The name of the user that should receive the message.
* @param message The message to whisper
*/
public void whisper(String userName, String message){
queue.add("PRIVMSG " + channel + " :/w " + userName + " " + message);
}

/**Enqueues a message at the end of the message queue. The message will be
* sent to the channel when all messages enqueued before it has been sent.
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/gikk/twirk/events/TwirkListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ default public void onAnything( String unformatedMessage ) {}
*/
default public void onPrivMsg( TwitchUser sender, TwitchMessage message ) {}

/**Fires for incoming WHISPER to the bot
/**Fires for incoming WHISPER to the bot. Please note that a whisper does
* not target a channel, and does not come from a channel. Thus, the flags
* for whether a users is a subscriber or not cannot be looked at, since
* the message didn't come through a channel chat room. Also, the
* {@link TwitchMessage#getTarget()} will always return the bot's name, since
* the target of the whisper was the bot.
*
* @param sender The user who sent the message. Parsed from the incoming message's tag
* @param message The message that was sent, with the tag removed
Expand Down