Refactored the script slightly.
Created a helper function for sending a message to the channel.