-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaemon.py
More file actions
23 lines (21 loc) · 814 Bytes
/
daemon.py
File metadata and controls
23 lines (21 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sqlite3
import time
conn = sqlite3.connect('mud-testing.db')
(lambda c:
c.executescript("""
BEGIN;
CREATE TABLE IF NOT EXISTS globalevents (id INTEGER PRIMARY KEY, type, text, time);
CREATE TABLE IF NOT EXISTS roomevents (id INTEGER PRIMARY KEY, type, text, time);
CREATE TABLE IF NOT EXISTS rooms (id INTEGER PRIMARY KEY, name, description, owner);
CREATE TABLE IF NOT EXISTS exits (id INTEGER PRIMARY KEY, src, dest, name, description);
CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name UNIQUE, pass);
COMMIT;
""")
)(conn.cursor())
while True:
time.sleep(10)
c=conn.cursor()
print "Inserting tone, "+time.asctime()
c.execute("INSERT INTO globalevents (type, text, time) VALUES ('time',?,datetime('now'));",("At the tone, the time will be: "+time.asctime(),))
c.close()
conn.commit()