Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 2c0ed9b

Browse files
committed
Add a method to get the twitch username in TwitchChatInput/Output
1 parent dd05183 commit 2c0ed9b

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

src/main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/chat/TwitchChatConnectListener.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class TwitchChatConnectListener(fn: (Boolean, String) => Unit) extends ListenerA
1414
override def onEvent(event: Event): Unit = {
1515
event match {
1616
case _: ConnectEvent => fn(true, "")
17-
case e: ConnectAttemptFailedEvent => fn(false, "couldn't connect to irc chat server")
17+
case _: ConnectAttemptFailedEvent => fn(false, "couldn't connect to irc chat server")
1818
case e: NoticeEvent =>
1919
if (e.getNotice.contains("authentication failed")) {
2020
fn(false, "authentication failed")

src/main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/chat/TwitchChatConnector.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ class TwitchChatConnector(override val sourceIdentifier: String) extends Connect
5353

5454
def isJoined(channel: String): Boolean = channels.contains(channel)
5555

56+
def getUsername: String = bot.getNick
57+
5658
private def getConfig: Configuration = {
5759

5860
if (credentials.isDefined) {

src/main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/chat/impl/TwitchChatInputImpl.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ class TwitchChatInputImpl extends EventInputImpl[TwitchEvent, chat.TwitchChatCon
103103
if (!sourceConnector.get.isJoined(currentChannel.get)) sourceConnector.get.joinChannel(currentChannel.get)
104104
}
105105

106+
override def getUsername: String = sourceConnector.get.getUsername
107+
106108
/**
107109
* Stops the input, called before source connector will shutdown
108110
*

src/main/scala/org/codeoverflow/chatoverflow/requirement/service/twitch/chat/impl/TwitchChatOutputImpl.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ class TwitchChatOutputImpl extends OutputImpl[chat.TwitchChatConnector] with Twi
2929
if (!sourceConnector.get.isJoined(currentChannel.get)) sourceConnector.get.joinChannel(currentChannel.get)
3030
}
3131

32+
override def getUsername: String = sourceConnector.get.getUsername
33+
3234
/**
3335
* Stops the output, called before source connector will shutdown
3436
*

0 commit comments

Comments
 (0)