aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlas Oliva <blasoliva@gmail.com>2015-01-24 00:03:18 -0300
committerBlas Oliva <blasoliva@gmail.com>2015-01-24 00:03:18 -0300
commit54aea6be18ba7008af9ff1ce9c57b8da225cf7f6 (patch)
tree65368de6b7e0854a054a7eb09b8e4a25f9ebe49d
parentfa21a862b12dc6e9bdee093f679ed45cc86bb4e7 (diff)
downloadreebot-54aea6be18ba7008af9ff1ce9c57b8da225cf7f6.tar.gz
reebot-54aea6be18ba7008af9ff1ce9c57b8da225cf7f6.zip
Reboot remenbers the first time
-rw-r--r--config.py1
-rwxr-xr-xreebot.py16
-rw-r--r--reemongo.py2
3 files changed, 17 insertions, 2 deletions
diff --git a/config.py b/config.py
index 893d9ab..50a6fb8 100644
--- a/config.py
+++ b/config.py
@@ -12,4 +12,5 @@ db_params = {
12 'database' : 'reevo', 12 'database' : 'reevo',
13 'feed_list' : 'feed_list', 13 'feed_list' : 'feed_list',
14 'log' : 'log', 14 'log' : 'log',
15 'users' : 'users',
15} 16}
diff --git a/reebot.py b/reebot.py
index 83bfb67..d51b455 100755
--- a/reebot.py
+++ b/reebot.py
@@ -92,9 +92,23 @@ class rBot:
92 """ Handle channel join 92 """ Handle channel join
93 93
94 source -- user who has joined the channel 94 source -- user who has joined the channel
95 target -- target of the command (channel)
95 """ 96 """
96 source = event.source().split( '!' ) [0] 97 source = event.source().split( '!' ) [0]
97 self.sendmessage( source, messages['welcome'] ) 98 target = event.target()
99
100 # Check if user has been accessed before
101 if self.db.users.find_one( { "user" : source } ) is None:
102 # If not insert the nickname into the database
103 self.db.users.insert( {
104 "user" : source,
105 "join_date" : time.strftime("%Y-%m-%d %H:%M:%S"),
106 "channel" : [ target ]
107 } )
108 # Send welcome message
109 self.sendmessage( source, messages['welcome'] )
110 else:
111 pass
98 112
99 def feed_refresh(self): 113 def feed_refresh(self):
100 """ Read feeds and sends the news to the channel """ 114 """ Read feeds and sends the news to the channel """
diff --git a/reemongo.py b/reemongo.py
index 0108d3b..c6b1095 100644
--- a/reemongo.py
+++ b/reemongo.py
@@ -10,5 +10,5 @@ class reemongo:
10 self.db = self.client[db_params['database']] 10 self.db = self.client[db_params['database']]
11 self.feed_list = self.db[db_params['feed_list']] 11 self.feed_list = self.db[db_params['feed_list']]
12 self.log = self.db[db_params['log']] 12 self.log = self.db[db_params['log']]
13 13 self.users = self.db[db_params['users']]
14 14