Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: KTX module * docs: Small documentation fix * Fix: Applied MR feedback * chore: Moved Kotlin dependencies back to its own module * fix: MR feedback & moved EventManagerKtx to events4j * Renamed file names * chore: update coroutines version * chore: tabs to spaces * fix: populate new constructor params in mock chat * fix: disable javadocs on kt files * feat: enable dokka * chore: add dokkaSourceSets and rename directory * refactor: AbstractChannelMessageEvent * docs: fix remote url Co-authored-by: Sidd <iProdigy@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
560 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ Project | |
* Chat | ||
* PubSub | ||
* GraphQL | ||
* Kotlin | ||
|
||
## Problems | ||
|
||
|
79 changes: 79 additions & 0 deletions
79
chat/src/main/java/com/github/twitch4j/chat/events/AbstractChannelMessageEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package com.github.twitch4j.chat.events; | ||
|
||
import com.github.twitch4j.chat.events.channel.IRCMessageEvent; | ||
import com.github.twitch4j.chat.events.channel.ReplyableEvent; | ||
import com.github.twitch4j.chat.flag.AutoModFlag; | ||
import com.github.twitch4j.common.annotation.Unofficial; | ||
import com.github.twitch4j.common.enums.CommandPermission; | ||
import com.github.twitch4j.common.events.domain.EventChannel; | ||
import com.github.twitch4j.common.events.domain.EventUser; | ||
import lombok.AccessLevel; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
@Data | ||
@Setter(AccessLevel.PRIVATE) | ||
@EqualsAndHashCode(callSuper = false) | ||
public abstract class AbstractChannelMessageEvent extends AbstractChannelEvent implements ReplyableEvent { | ||
|
||
/** | ||
* RAW Message Event | ||
*/ | ||
private IRCMessageEvent messageEvent; | ||
|
||
/** | ||
* User | ||
*/ | ||
private EventUser user; | ||
|
||
/** | ||
* Message | ||
*/ | ||
private String message; | ||
|
||
/** | ||
* Permissions of the user | ||
*/ | ||
private Set<CommandPermission> permissions; | ||
|
||
/** | ||
* The exact number of months the user has been a subscriber, or zero if not subscribed | ||
*/ | ||
private int subscriberMonths; | ||
|
||
/** | ||
* The tier at which the user is subscribed (prime is treated as 1), or zero if not subscribed | ||
*/ | ||
private int subscriptionTier; | ||
|
||
/** | ||
* Nonce | ||
*/ | ||
@Unofficial | ||
@Getter(lazy = true) | ||
private final String nonce = getMessageEvent().getNonce().orElse(null); | ||
|
||
public AbstractChannelMessageEvent(EventChannel channel, IRCMessageEvent messageEvent, EventUser user, String message, Set<CommandPermission> permissions) { | ||
super(channel); | ||
this.messageEvent = messageEvent; | ||
this.user = user; | ||
this.message = message; | ||
this.permissions = permissions; | ||
this.subscriberMonths = messageEvent.getSubscriberMonths().orElse(0); | ||
this.subscriptionTier = messageEvent.getSubscriptionTier().orElse(0); | ||
} | ||
|
||
/** | ||
* @return the regions of the message that were flagged by AutoMod. | ||
*/ | ||
@Unofficial | ||
public List<AutoModFlag> getFlags() { | ||
return this.getMessageEvent().getFlags(); | ||
} | ||
|
||
} |
81 changes: 17 additions & 64 deletions
81
chat/src/main/java/com/github/twitch4j/chat/events/channel/ChannelMessageActionEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,33 @@ | ||
package com.github.twitch4j.chat.events.channel; | ||
|
||
import com.github.twitch4j.chat.events.AbstractChannelEvent; | ||
import com.github.twitch4j.chat.flag.AutoModFlag; | ||
import com.github.twitch4j.common.annotation.Unofficial; | ||
import com.github.twitch4j.chat.events.AbstractChannelMessageEvent; | ||
import com.github.twitch4j.common.enums.CommandPermission; | ||
import com.github.twitch4j.common.events.domain.EventChannel; | ||
import com.github.twitch4j.common.events.domain.EventUser; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.Value; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
|
||
/** | ||
* This event gets called when a action message (/me text) is received in a channel. | ||
* This event gets called when an action message (/me text) is received in a channel. | ||
*/ | ||
@Value | ||
@Getter | ||
@EqualsAndHashCode(callSuper = false) | ||
public class ChannelMessageActionEvent extends AbstractChannelEvent implements ReplyableEvent { | ||
public class ChannelMessageActionEvent extends AbstractChannelMessageEvent { | ||
|
||
/** | ||
* RAW Message Event | ||
*/ | ||
private final IRCMessageEvent messageEvent; | ||
|
||
/** | ||
* User | ||
*/ | ||
private EventUser user; | ||
|
||
/** | ||
* Message | ||
*/ | ||
private String message; | ||
|
||
/** | ||
* Permissions of the user | ||
*/ | ||
private Set<CommandPermission> permissions; | ||
|
||
/** | ||
* The exact number of months the user has been a subscriber, or zero if not subscribed | ||
*/ | ||
private int subscriberMonths; | ||
|
||
/** | ||
* The tier at which the user is subscribed (prime is treated as 1), or zero if not subscribed | ||
*/ | ||
private int subscriptionTier; | ||
|
||
/** | ||
* Event Constructor | ||
* | ||
* @param channel The channel that this event originates from. | ||
* Event Constructor | ||
* | ||
* @param channel The channel that this event originates from. | ||
* @param messageEvent The raw message event | ||
* @param user The user who triggered the event. | ||
* @param message The plain text of the message. | ||
* @param permissions The permissions of the triggering user. | ||
*/ | ||
public ChannelMessageActionEvent(EventChannel channel, IRCMessageEvent messageEvent, EventUser user, String message, Set<CommandPermission> permissions) { | ||
super(channel); | ||
this.messageEvent = messageEvent; | ||
this.user = user; | ||
this.message = message; | ||
this.permissions = permissions; | ||
this.subscriberMonths = messageEvent.getSubscriberMonths().orElse(0); | ||
this.subscriptionTier = messageEvent.getSubscriptionTier().orElse(0); | ||
} | ||
|
||
/** | ||
* @return the regions of the message that were flagged by AutoMod. | ||
* @param user The user who triggered the event. | ||
* @param message The plain text of the message. | ||
* @param permissions The permissions of the triggering user. | ||
*/ | ||
@Unofficial | ||
public List<AutoModFlag> getFlags() { | ||
return this.messageEvent.getFlags(); | ||
public ChannelMessageActionEvent( | ||
EventChannel channel, | ||
IRCMessageEvent messageEvent, | ||
EventUser user, String message, | ||
Set<CommandPermission> permissions | ||
) { | ||
super(channel, messageEvent, user, message, permissions); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 13 additions & 18 deletions
31
chat/src/main/java/com/github/twitch4j/chat/events/channel/HostOffEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,26 @@ | ||
package com.github.twitch4j.chat.events.channel; | ||
|
||
import com.github.twitch4j.chat.events.TwitchEvent; | ||
import com.github.twitch4j.chat.events.AbstractChannelEvent; | ||
import com.github.twitch4j.common.events.domain.EventChannel; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.ToString; | ||
import lombok.Value; | ||
|
||
/** | ||
* This event gets called when the user stops hosting someone. | ||
*/ | ||
@Value | ||
@Getter | ||
@EqualsAndHashCode(callSuper = false) | ||
public class HostOffEvent extends TwitchEvent { | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
public class HostOffEvent extends AbstractChannelEvent { | ||
|
||
/** | ||
* Event ChatChannel | ||
*/ | ||
private EventChannel channel; | ||
|
||
/** | ||
* Event Constructor | ||
* | ||
* @param channel The channel that this event originates from. | ||
*/ | ||
public HostOffEvent(EventChannel channel) { | ||
this.channel = channel; | ||
} | ||
/** | ||
* Event Constructor | ||
* | ||
* @param channel The channel that this event originates from. | ||
*/ | ||
public HostOffEvent(EventChannel channel) { | ||
super(channel); | ||
} | ||
|
||
} |
Oops, something went wrong.