Save when a user sends their "first" words (won't be correct for old users)

This commit is contained in:
jesopo 2018-08-28 15:33:18 +01:00
parent 527d548743
commit f8a6aa087b

View file

@ -1,3 +1,4 @@
import time
import Utils import Utils
class Module(object): class Module(object):
@ -27,6 +28,10 @@ class Module(object):
user_words = event["channel"].get_user_setting(user.id, user_words = event["channel"].get_user_setting(user.id,
"words", 0) "words", 0)
user_words += word_count user_words += word_count
if user.get_setting("first-words", None) == None:
user.set_setting("first-words", time.time())
event["channel"].set_user_setting(user.id, event["channel"].set_user_setting(user.id,
"words", user_words) "words", user_words)