Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

Commit

Permalink
Fixed regression caused by replacing array maps with filters, cus dum…
Browse files Browse the repository at this point in the history
…b head.
  • Loading branch information
rjackson committed Sep 26, 2013
1 parent 6ddb2de commit 658ce56
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions handlers/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Dota2.Dota2Client.prototype.leaveChat = function(channel) {
}

if (this.debug) util.log("Leaving chat channel: " + channel);
var channelId = this.chatChannels.filter(function (item) {if (item.channelName == channel) return item.channelId; })[0];
var channelId = this.chatChannels.filter(function (item) {if (item.channelName == channel) return true; }).map(function (item) { return item.channelId })[0]
if (channelId === undefined) {
if (this.debug) util.log("Cannot leave a channel you have not joined.");
return;
Expand All @@ -54,7 +54,7 @@ Dota2.Dota2Client.prototype.sendMessage = function(channel, message) {
}

if (this.debug) util.log("Sending message to " + channel);
var channelId = this.chatChannels.filter(function (item) {if (item.channelName == channel) return item.channelId; })[0];
var channelId = this.chatChannels.filter(function (item) {if (item.channelName == channel) return true; }).map(function (item) { return item.channelId })[0]
if (channelId === undefined) {
if (this.debug) util.log("Cannot send message to a channel you have not joined.");
return;
Expand Down Expand Up @@ -82,7 +82,7 @@ handlers[Dota2.EDOTAGCMsg.k_EMsgGCChatMessage] = function onChatMessage(message)
/* Chat channel message from another user. */
var chatData = dota_gcmessages.CMsgDOTAChatMessage.parse(message);
this.emit("chatMessage",
this.chatChannels.filter(function (item) {if (item.channelId === chatData.channelId) return item.channelName; })[0],
this.chatChannels.filter(function (item) {if (item.channelName == channel) return true; }).map(function (item) { return item.channelId })[0],
chatData.personaName,
chatData.text,
chatData);
Expand Down

0 comments on commit 658ce56

Please sign in to comment.