Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setTimeout(() => {
let replyMessage = new Message();
replyMessage.message = "You have typed '" + message.message + "'";
replyMessage.dateSent = new Date();
if (isNaN(message.toId))
{
let group = DemoAdapter.mockedParticipants.find(x => x.id == message.toId) as Group;
// Message to a group. Pick up any participant for this
let randomParticipantIndex = Math.floor(Math.random() * group.chattingTo.length);
replyMessage.fromId = group.chattingTo[randomParticipantIndex].id;
replyMessage.toId = message.toId;
this.onMessageReceived(group, replyMessage);
}
setTimeout(() => {
let replyMessage = new Message();
replyMessage.fromId = message.toId;
replyMessage.toId = message.fromId;
replyMessage.message = "You have typed '" + message.message + "'";
let user = DemoAdapter.mockedUsers.find(x => x.id == replyMessage.fromId);
this.onMessageReceived(user, replyMessage);
}, 1000);
}