import discord
import logging
import sqlite3
+import time
import uuid
log = logging.getLogger('db')
self.open_db(filename)
self.create_tables()
- def uuid():
+ def uuid(self):
return str(uuid.uuid4())
+ def now(self):
+ return int(time.time())
+
def open_db(self, filename):
self.dbh = sqlite3.connect(filename)
self.dbh.row_factory = sqlite3.Row
return cursor
def get_state(self, client):
- cursor = self.dbh.cursor()
- self.query('select avatar, idle, last_spoke from state where bot_id=?', [client.user.id])
+ cursor = self.query('select avatar, idle, last_spoke from state where bot_id=?', [client.user.id])
row = cursor.fetchone()
if row is None:
return None