Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBotGroup/timeTalk.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (25 sloc)
1.38 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
def timeTalk(number): | |
now = datetime.now() | |
currentMonth = now.month | |
currentHour = now.hour | |
spring = [3, 4, 5] | |
summer = [6, 7, 8] | |
autumn = [9, 10, 11] | |
winter = [12, 1, 2] | |
if number == 1: | |
if currentHour >= 23 or currentHour <= 4: | |
return "Why are you awake? Do you know what time it is?" | |
elif currentHour >= 4 and currentHour <= 9: | |
return "You know what they say, the early bird catches the worm." | |
elif currentHour >= 11 and currentHour <= 15: | |
return "Did you had lunch yet? If not, you really should." | |
if number == 2: | |
if (currentMonth == spring[0]) or (currentMonth == spring[1]) or (currentMonth == spring[2]): | |
return "Spring is here, you should go get some fresh air." | |
if (currentMonth == summer[0]) or (currentMonth == summer[1]) or (currentMonth == summer[2]): | |
return "It's Summer!! Time to go get a tan at the beach." | |
if (currentMonth == autumn[0]) or (currentMonth == autumn[1]) or (currentMonth == autumn[2]): | |
return "It's Autumn, and that means the 'Winter is coming', better prepare yourself." | |
if (currentMonth == winter[0]) or (currentMonth == winter[1]) or (currentMonth == winter[2]): | |
return "The Winter is finally here, I hope you have a good Christmas or Hanukkah or whatever you celebrate." |