Skip to content

Instantly share code, notes, and snippets.

@pmbanugo
Created December 23, 2019 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmbanugo/7a53e20642c6197a0b27c9e86b3f609f to your computer and use it in GitHub Desktop.
Save pmbanugo/7a53e20642c6197a0b27c9e86b3f609f to your computer and use it in GitHub Desktop.
addMessage = ({ message }) => {
if (!this.user) {
this.user = { name: message.text, id: Date.now().toString() };
let newMessage = Object.assign({}, message);
newMessage.text = `Welcome to the chat ${message.text}!`;
newMessage.author = this.bot;
this.setState({
messages: [...this.state.messages, newMessage]
});
} else {
//TODO: Send message across the channel
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment