tip is picked at random

pull/1038/head
Hubert Bryłkowski 3 years ago committed by Disconnect3d
parent 417215fada
commit 3d90b2916d

@ -1,5 +1,4 @@
from datetime import datetime
from hashlib import md5
from random import choice
TIPS = [
"Don't eat yellow snow",
@ -8,8 +7,4 @@ TIPS = [
def get_tip_of_the_day() -> str:
day_since_epoch = (datetime.utcnow() - datetime(1970, 1, 1)).days
hash_of_the_day = md5(day_since_epoch.to_bytes(8, 'big', )).hexdigest()
tip_chosen = int(hash_of_the_day, 16) % len(TIPS)
return TIPS[tip_chosen]
return choice(TIPS)

Loading…
Cancel
Save