auto scroll to end when new message is added
refactors the code that sends the user joined message