-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #259 from 15sawyer/main
Record chat members predictions + 'mostTrusted' outcome picker.
- Loading branch information
Showing
128 changed files
with
2,290 additions
and
508 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,9 @@ | |
/out | ||
/streamers | ||
/target | ||
bin/ | ||
|
||
*.iml | ||
/analytics.db | ||
/config.json | ||
/log4j2.xml |
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
10 changes: 10 additions & 0 deletions
10
...main/java/fr/raksrinana/channelpointsminer/miner/api/chat/ITwitchChatMessageListener.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,10 @@ | ||
package fr.raksrinana.channelpointsminer.miner.api.chat; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
|
||
public interface ITwitchChatMessageListener{ | ||
|
||
void onChatMessage(@NotNull String streamer, @NotNull String actor, @NotNull String message); | ||
|
||
void onChatMessage(@NotNull String streamer, @NotNull String actor, @NotNull String message, @NotNull String badges); | ||
} |
24 changes: 24 additions & 0 deletions
24
...rc/main/java/fr/raksrinana/channelpointsminer/miner/api/chat/TwitchChatEventProducer.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,24 @@ | ||
package fr.raksrinana.channelpointsminer.miner.api.chat; | ||
|
||
import fr.raksrinana.channelpointsminer.miner.event.impl.ChatMessageEvent; | ||
import fr.raksrinana.channelpointsminer.miner.factory.TimeFactory; | ||
import fr.raksrinana.channelpointsminer.miner.miner.IMiner; | ||
import lombok.RequiredArgsConstructor; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@RequiredArgsConstructor | ||
public class TwitchChatEventProducer implements ITwitchChatMessageListener{ | ||
@NotNull | ||
private final IMiner miner; | ||
|
||
@Override | ||
public void onChatMessage(@NotNull String streamer, @NotNull String actor, @NotNull String message){ | ||
onChatMessage(streamer, actor, message, ""); | ||
} | ||
|
||
@Override | ||
public void onChatMessage(@NotNull String streamer, @NotNull String actor, @NotNull String message, @NotNull String badges){ | ||
var event = new ChatMessageEvent(miner, TimeFactory.now(), streamer, actor, message, badges); | ||
miner.onEvent(event); | ||
} | ||
} |
30 changes: 0 additions & 30 deletions
30
miner/src/main/java/fr/raksrinana/channelpointsminer/miner/api/chat/TwitchChatFactory.java
This file was deleted.
Oops, something went wrong.
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
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
47 changes: 47 additions & 0 deletions
47
...ain/java/fr/raksrinana/channelpointsminer/miner/api/chat/irc/TwitchIrcMessageHandler.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,47 @@ | ||
package fr.raksrinana.channelpointsminer.miner.api.chat.irc; | ||
|
||
import fr.raksrinana.channelpointsminer.miner.api.chat.ITwitchChatMessageListener; | ||
import fr.raksrinana.channelpointsminer.miner.log.LogContext; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.log4j.Log4j2; | ||
import net.engio.mbassy.listener.Handler; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.kitteh.irc.client.library.event.channel.ChannelMessageEvent; | ||
import java.util.Collection; | ||
import java.util.LinkedList; | ||
|
||
@RequiredArgsConstructor | ||
@Log4j2 | ||
public class TwitchIrcMessageHandler{ | ||
|
||
@NotNull | ||
private final String accountName; | ||
|
||
@NotNull | ||
private final Collection<ITwitchChatMessageListener> listeners = new LinkedList<>(); | ||
|
||
@Handler | ||
public void onMessageEvent(@NotNull ChannelMessageEvent event){ | ||
try(var ignored = LogContext.with(accountName)){ | ||
log.trace("Received Irc Chat Message"); | ||
var badges = event.getTag("badges"); | ||
if(badges.isPresent()){ | ||
listeners.forEach(l -> l.onChatMessage( | ||
event.getChannel().getName().substring(1), | ||
event.getActor().getMessagingName(), | ||
event.getMessage(), | ||
badges.get().getAsString())); | ||
} | ||
else{ | ||
listeners.forEach(l -> l.onChatMessage( | ||
event.getChannel().getName().substring(1), | ||
event.getActor().getMessagingName(), | ||
event.getMessage())); | ||
} | ||
} | ||
} | ||
|
||
public void addListener(ITwitchChatMessageListener listener){ | ||
listeners.add(listener); | ||
} | ||
} |
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
Oops, something went wrong.