Skip to content

Commit ea1136a

Browse files
authored
Merge pull request #16 from Gikkman/dev-0.5
Dev 0.5
2 parents 0e7ba86 + 3ae9022 commit ea1136a

4 files changed

Lines changed: 42 additions & 17 deletions

File tree

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# Java-Twirk
22
[![](https://jitpack.io/v/Gikkman/Java-Twirk.svg)](https://jitpack.io/#Gikkman/Java-Twirk)
3-
[![](https://img.shields.io/gitter/room/gitterHQ/gitter.svg)](https://gitter.im/Java-Twirk/Twirk#)
4-
You can also contact us via the [Discord Server](https://discord.gg/8NXaEyV)
3+
You can contact us via the [Discord Server](https://discord.gg/8NXaEyV)
54

6-
Small, basic library for creating an IRC connection to the Twitch chat.
5+
Small, library for creating an IRC connection to the Twitch chat.
76

87
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.
98

@@ -23,25 +22,21 @@ Include the following in your pom.xml
2322
<dependency>
2423
<groupId>com.github.gikkman</groupId>
2524
<artifactId>Java-Twirk</artifactId>
26-
<version>LATEST_RELEASE_VERION_HERE</version>
25+
<version>0.5</version>
2726
</dependency>
2827
</dependencies>
2928
```
3029
Or simply download the latest version of the library jar from the release page.
3130

3231
## Changes
33-
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)
34-
* Added support for Subscription Gift
35-
* Added support for Raid
36-
* Encapsulated all default factories (previously all public under GikkDefault_<NAME HERE>)
37-
* TwirkListenerBaseImpl has been removed, please implement TwirkListener instead
38-
* Mode-events has been depricated (please use the TwitchUser.isMod() instead)
39-
* Subscriber-event has been removed. It is now found under Usernotice-event instead (Twitch has changed their grouping)
40-
* USER_TYPES now has category SUBSCRIBER, which is given to regular subs and turbo subs.
41-
* USER_TYPES now has ranks, which allows you to do if( user.getUserType().value >= USER_TYPE.SUBSCRIBER.value )
42-
* Added the isOwner() status on TwichUser
32+
There has been some new features in version 0.5, but nothing that is breaking backwards compability. New features include:
33+
* Whispers (This was removed in 0.4, but is now back. Twitch said they'd remove it , but they haven't so far so...)
34+
* Support for new sub-streak logic
35+
* Updated the example
36+
* Added even more tests
37+
* Touched up on some JavaDoc
4338

44-
And probably some more. Thankfully, Java is a strongly typed language :D
39+
And probably some more...
4540

4641
# Usage
4742
#### Basic usage

src/example/java/com/gikk/twirk/BotExample.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.gikk.twirk.events.TwirkListener;
66
import java.io.IOException;
77
import java.io.InputStreamReader;
8-
import java.nio.charset.StandardCharsets;
98
import java.util.Scanner;
109

1110
/**Simple example of how Twirk can be used. <br><br>

src/main/java/com/gikk/twirk/Twirk.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,32 @@ public final class Twirk {
134134
public void serverMessage(String message) {
135135
outThread.quickSend(message);
136136
}
137+
138+
/**Enqueues a whisper at the end of the message queue. The whisper will
139+
* be sent when all messages enqueued before it has been sent.
140+
* <br>
141+
* Be aware that too frequent use of whispers might get your bot rate
142+
* limited.
143+
*
144+
* @param receiver The user that should receive the message
145+
* @param message The message to whisper
146+
*/
147+
public void whisper(TwitchUser receiver, String message){
148+
whisper(receiver.getUserName(), message);
149+
}
150+
151+
/**Enqueues a whisper at the end of the message queue. The whisper will
152+
* be sent when all messages enqueued before it has been sent.
153+
* <br>
154+
* Be aware that too frequent use of whispers might get your bot rate
155+
* limited.
156+
*
157+
* @param userName The name of the user that should receive the message.
158+
* @param message The message to whisper
159+
*/
160+
public void whisper(String userName, String message){
161+
queue.add("PRIVMSG " + channel + " :/w " + userName + " " + message);
162+
}
137163

138164
/**Enqueues a message at the end of the message queue. The message will be
139165
* sent to the channel when all messages enqueued before it has been sent.

src/main/java/com/gikk/twirk/events/TwirkListener.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,12 @@ default public void onAnything( String unformatedMessage ) {}
2626
*/
2727
default public void onPrivMsg( TwitchUser sender, TwitchMessage message ) {}
2828

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

0 commit comments

Comments
 (0)