Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
AmirMuratov committed Apr 2, 2018
1 parent 35ae337 commit 71d844d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 12 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name := "TwitchIRC"

version := "0.1.1"
version := "0.1.3"

scalaVersion := "2.12.5"

Expand Down
8 changes: 0 additions & 8 deletions src/main/scala/bot/twitchirc/TwitchIRCActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class TwitchIRCActor(address: InetSocketAddress, nick: String, oauth: String, pr
private val messageParser = new MessageParser(nick)
private var listeners: Set[ActorRef] = Set.empty

private var sentMessages: Map[(String, String), Cancellable] = Map.empty
private var joins: Map[String, Cancellable] = Map.empty
private var parts: Map[String, Cancellable] = Map.empty
private var channelsToUsers: Map[String, Seq[String]] = Map.empty
Expand Down Expand Up @@ -106,9 +105,6 @@ class TwitchIRCActor(address: InetSocketAddress, nick: String, oauth: String, pr
case PartConfirmation(channel) =>
parts.get(channel).foreach(_.cancel())
parts -= channel
case MessageDeliverConfirmation(channel, message) =>
sentMessages.get((channel, message)).foreach(_.cancel())
sentMessages -= ((channel, message))

case ChannelUserList(channel, users) =>
channelsToUsers += channel -> (users ++ channelsToUsers.getOrElse(channel, Seq()))
Expand Down Expand Up @@ -149,10 +145,6 @@ class TwitchIRCActor(address: InetSocketAddress, nick: String, oauth: String, pr
case SendMessage(name, message) =>
val channelName = name.toLowerCase
tcpClientActor ! SendData(s"PRIVMSG $channelName :$message")
sentMessages += (channelName, message) -> context.system.scheduler.scheduleOnce(respondTimeout)({
log.error(s"Twitch server doesn't respond PRIVMSG $channelName, $message request")
parts -= (channelName, message)
})
case SendWhisper(name, message) =>
val userName = name.toLowerCase
tcpClientActor ! SendData(s"PRIVMSG #$nick :/w $userName $message")
Expand Down
1 change: 0 additions & 1 deletion src/main/scala/bot/twitchirc/messages/Message.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ object Message {

private[twitchirc] case class JoinConfirmation(channel: String) extends Message
private[twitchirc] case class PartConfirmation(channel: String) extends Message
private[twitchirc] case class MessageDeliverConfirmation(channel: String, message: String) extends Message

case class UserJoinedChannel(user: String, channel: String) extends Message
case class UserLeftChannel(user: String, channel: String) extends Message
Expand Down
2 changes: 0 additions & 2 deletions src/main/scala/bot/twitchirc/messages/MessageParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class MessageParser(nick: String) {
private val pingRegexp = "PING :tmi.twitch.tv".r
private val successfulJoin = s":$nick!$nick@$nick.tmi.twitch.tv JOIN ($nameTemplate)".r
private val successfulPart = s":$nick!$nick@$nick.tmi.twitch.tv PART ($nameTemplate)".r
private val successfulPrivmsg = s":$nick!$nick@$nick.tmi.twitch.tv PRIVMSG ($nameTemplate) :(.*)".r //should be before incomingChatMessage

//membership
private val userJoinedChannel = s":($nameTemplate)!$nameTemplate@$nameTemplate.tmi.twitch.tv JOIN ($nameTemplate)".r
Expand Down Expand Up @@ -47,7 +46,6 @@ class MessageParser(nick: String) {
case pingRegexp() => Ping
case successfulJoin(channel) => JoinConfirmation(channel)
case successfulPart(channel) => PartConfirmation(channel)
case successfulPrivmsg(channel, message) => MessageDeliverConfirmation(channel, message)

case userJoinedChannel(user, channel) => UserJoinedChannel(user, channel)
case userLeftChannel(user, channel) => UserLeftChannel(user, channel)
Expand Down

0 comments on commit 71d844d

Please sign in to comment.