handle shutdown method
create send_chat_message function
refactor send_message function