Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c6fe685

Browse files
authoredNov 2, 2016
Merge pull request #1571 from JoseAntonioRodriguez/fix-console-connector
Fix loop indexes are being meshed up in the ConsoleConnector
2 parents 8370d18 + 47554cd commit c6fe685

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed
 

‎Node/core/src/bots/ConsoleConnector.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class ConsoleConnector implements ub.IConnector {
4040
private handler: (events: IEvent[], cb?: (err: Error) => void) => void;
4141
private rl: readline.ReadLine;
4242
private replyCnt = 0;
43-
43+
4444
public listen(): this {
4545
this.rl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false });
4646
this.rl.on('line', (line: string) => {
@@ -72,11 +72,11 @@ export class ConsoleConnector implements ub.IConnector {
7272
}
7373
return this;
7474
}
75-
75+
7676
public onEvent(handler: (events: IEvent[], cb?: (err: Error) => void) => void): void {
7777
this.handler = handler;
7878
}
79-
79+
8080
public send(messages: IMessage[], done: (err: Error) => void): void {
8181
for (var i = 0; i < messages.length; i++ ){
8282
if (this.replyCnt++ > 0) {
@@ -87,14 +87,14 @@ export class ConsoleConnector implements ub.IConnector {
8787
log(msg.text);
8888
}
8989
if (msg.attachments && msg.attachments.length > 0) {
90-
for (var i = 0; i < msg.attachments.length; i++) {
91-
if (i > 0) {
90+
for (var j = 0; j < msg.attachments.length; j++) {
91+
if (j > 0) {
9292
console.log();
9393
}
94-
renderAttachment(msg.attachments[i]);
94+
renderAttachment(msg.attachments[j]);
9595
}
9696
}
97-
}
97+
}
9898

9999
done(null);
100100
}

0 commit comments

Comments
 (0)
Please sign in to comment.