Chat bot disconnects, reconnects and then start receiving DOUBLE messages

I have been killing myself over this issue but somehow, whenever the chatbot gets disconnected from the server and reconnects after running for a while, it starts receiving the same message TWICE.
I cant seem to find any issue with the code as it works fine before the reconnect. My code is in the GitHub link here - GitHub - NyanDesigns/xLi_B0t.
Thanks for ur help!

You have two client.connect()

One on line 34 and one one line 36