Bläddra i källkod

minor botfixes

tBKwtWS 6 år sedan
förälder
incheckning
5ff075f87f
2 ändrade filer med 4 tillägg och 1 borttagningar
  1. 1 1
      rotbot/bot.py
  2. 3 0
      rotbot/events/on_join.py

+ 1 - 1
rotbot/bot.py

@@ -223,7 +223,7 @@ def main():
 
     username = 'pyrot'
     password = 'oGPnbiqh55QKLhmnKQgS92h74j0e9d6LE58cSsD1'
-    db_connect_string='postgres://%s:%s@localhost/website' % username, password
+    db_connect_string = 'postgres://%s:%s@localhost/website' % (username, password)
     try:
         db = Postgres(db_connect_string)    # Connect to database.
     except:

+ 3 - 0
rotbot/events/on_join.py

@@ -20,6 +20,9 @@ def process_event(self, connection, event):
     channel = queries.create_ifnot_onrecord(self, 'channel', event.target)
     user = queries.create_ifnot_onrecord(self, 'user', event.source.nick)
 
+    print(self.network.id)
+    print(channel.id)
+    print(user.id)
     # Save to join event database.
     if not self.db.one('SELECT id FROM rotbot_join WHERE network_id=%(network_id)s AND channel_id=%(channel_id)s AND "user_id"=%(user_id)s', network_id=self.network.id, channel_id=channel.id, user_id=user.id):   # No record yet
         self.db.run('INSERT INTO rotbot_join (network_id, channel_id, user_id, amount) VALUES (%(network_id)s, %(channel_id)s, %(user_id)s, 1)', network_id=self.network.id, channel_id=channel.id, user_id=user.id)   # Create record.