Skip to content
Permalink
Browse files

Also fix function passing for discord

  • Loading branch information...
joblo2213 committed Jul 13, 2019
1 parent 70956ce commit 2b80cc383693b13484a4f78706d4b98a4d682f1b
@@ -34,12 +34,18 @@ class DiscordChatInputImpl extends EventInputImpl[DiscordEvent, DiscordChatConne
private val privateMessages = ListBuffer[DiscordChatMessage]()
private var channelId: Option[String] = None

private val onMessageFn = onMessage _
private val onMessageUpdateFn = onMessageUpdate _
private val onMessageDeleteFn = onMessageDelete _
private val onReactionAddedFn = onReactionAdded _
private val onReactionRemovedFn = onReactionRemoved _

override def start(): Boolean = {
sourceConnector.get.addMessageReceivedListener(onMessage)
sourceConnector.get.addMessageUpdateListener(onMessageUpdate)
sourceConnector.get.addMessageDeleteListener(onMessageDelete)
sourceConnector.get.addReactionAddEventListener(onReactionAdded)
sourceConnector.get.addReactionDelEventListener(onReactionRemoved)
sourceConnector.get.addMessageReceivedListener(onMessageFn)
sourceConnector.get.addMessageUpdateListener(onMessageUpdateFn)
sourceConnector.get.addMessageDeleteListener(onMessageDeleteFn)
sourceConnector.get.addReactionAddEventListener(onReactionAddedFn)
sourceConnector.get.addReactionDelEventListener(onReactionRemovedFn)
true
}

@@ -82,11 +88,11 @@ class DiscordChatInputImpl extends EventInputImpl[DiscordEvent, DiscordChatConne
* @return true if stopping was successful
*/
override def stop(): Boolean = {
sourceConnector.get.removeMessageReceivedListener(onMessage)
sourceConnector.get.removeMessageUpdateListener(onMessageUpdate)
sourceConnector.get.removeMessageDeleteListener(onMessageDelete)
sourceConnector.get.removeReactionAddEventListener(onReactionAdded)
sourceConnector.get.removeReactionDelEventListener(onReactionRemoved)
sourceConnector.get.removeMessageReceivedListener(onMessageFn)
sourceConnector.get.removeMessageUpdateListener(onMessageUpdateFn)
sourceConnector.get.removeMessageDeleteListener(onMessageDeleteFn)
sourceConnector.get.removeReactionAddEventListener(onReactionAddedFn)
sourceConnector.get.removeReactionDelEventListener(onReactionRemovedFn)
true
}

0 comments on commit 2b80cc3

Please sign in to comment.
You can’t perform that action at this time.