Skip to content

Commit

Permalink
Fixed message issues and formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlOfDuty committed Oct 23, 2018
1 parent 9b14bed commit 8567891
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions DyscordBot/DyscordBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function setChannelTopic(channelID, topic)
}

// TCP server events /////////////////////////////
tcpServer.on('connection', (socket) =>
tcpServer.on("connection", (socket) =>
{
sockets.push(socket);

Expand Down Expand Up @@ -222,7 +222,7 @@ tcpServer.on('connection', (socket) =>
console.log("Socket error <" + data.message + ">");
}
});
})
});

console.log("Binding TCP port...");
tcpServer.listen(listeningPort, () =>
Expand Down Expand Up @@ -260,7 +260,10 @@ discordClient.on("message", (message) =>
}
else
{
socket.write("message[Discord] " + message.author.username + ": " + message.content + "\n");
sockets.forEach((socket) =>
{
socket.write("message[Discord] " + message.author.username + ": " + message.content + "\n");
});
}
});

Expand Down Expand Up @@ -308,7 +311,7 @@ function shutdown()

tcpServer.close(() =>
{
console.log('TCP server closed.');
console.log("TCP server closed.");
tcpServer.unref();
});

Expand All @@ -328,5 +331,5 @@ function shutdown()
process.on("exit", () => shutdown());
process.on("SIGINT", () => shutdown());
process.on("SIGUSR1", () => shutdown());
process.on("SIGUSR2", () =>shutdown());
process.on("SIGUSR2", () => shutdown());
process.on("SIGHUP", () => shutdown());

0 comments on commit 8567891

Please sign in to comment.