Move sqlite databases to a subfolder
parent
3d17d8ea48
commit
4ad3d24507
|
@ -6,6 +6,8 @@ Licensed under GNU General Public License v2.0
|
|||
"""
|
||||
import time, sqlite3
|
||||
|
||||
DBPATH = "data/antiabuse.sqlite"
|
||||
|
||||
antiabuse = {}
|
||||
antiabuse["ignorelist"] = []
|
||||
antiabuse["cooldown_l"] = {}
|
||||
|
@ -13,7 +15,7 @@ antiabuse["cooldown"] = 3 # seconds
|
|||
|
||||
def api_ignore(mask):
|
||||
antiabuse["ignorelist"].append(mask)
|
||||
db = sqlite3.connect("antiabuse.sqlite")
|
||||
db = sqlite3.connect(DBPATH)
|
||||
c = db.cursor()
|
||||
c.execute("INSERT INTO ignore (nick) VALUES (?)", (mask,))
|
||||
c.close()
|
||||
|
@ -24,7 +26,7 @@ def api_unignore(mask):
|
|||
if not mask in antiabuse["ignorelist"]:
|
||||
return False
|
||||
antiabuse['ignorelist'].remove(mask)
|
||||
db = sqlite3.connect("antiabuse.sqlite")
|
||||
db = sqlite3.connect(DBPATH)
|
||||
c = db.cursor()
|
||||
c.execute("DELETE FROM ignore WHERE nick = ?", (mask,))
|
||||
c.close()
|
||||
|
@ -137,7 +139,7 @@ def listignore(phenny, input):
|
|||
listignore.commands = ['listignore']
|
||||
listignore.priority = 'high'
|
||||
|
||||
db = sqlite3.connect("antiabuse.sqlite")
|
||||
db = sqlite3.connect(DBPATH)
|
||||
c = db.cursor()
|
||||
c.execute('''CREATE TABLE IF NOT EXISTS ignore (nick text)''')
|
||||
c.execute("SELECT * FROM ignore")
|
||||
|
|
2
seen.py
2
seen.py
|
@ -10,7 +10,7 @@ import time
|
|||
from threading import Thread, Lock
|
||||
import sqlite3
|
||||
|
||||
DBPATH = "seen.sqlite"
|
||||
DBPATH = "data/seen.sqlite"
|
||||
updates = list()
|
||||
updates_l = Lock()
|
||||
|
||||
|
|
6
tell.py
6
tell.py
|
@ -10,12 +10,14 @@ import time
|
|||
import calendar
|
||||
import hashlib
|
||||
|
||||
DBPATH = "data/tell.sqlite"
|
||||
|
||||
tell_list = []
|
||||
tell_pending = []
|
||||
|
||||
def tell_diskwr():
|
||||
global tell_pending, tell_list
|
||||
db = sqlite3.connect("tell.sqlite")
|
||||
db = sqlite3.connect(DBPATH)
|
||||
c = db.cursor()
|
||||
for tr in tell_pending:
|
||||
if tr[0] == "del":
|
||||
|
@ -126,7 +128,7 @@ note_join.event = 'JOIN'
|
|||
note_join.priority = 'low'
|
||||
note_join.nohook = True
|
||||
|
||||
db = sqlite3.connect("tell.sqlite")
|
||||
db = sqlite3.connect(DBPATH)
|
||||
c = db.cursor()
|
||||
c.execute("CREATE TABLE IF NOT EXISTS tell (id INTEGER PRIMARY KEY, nick TEXT, tellee TEXT, msg TEXT, time INTEGER)")
|
||||
c.execute("SELECT * FROM tell")
|
||||
|
|
Loading…
Reference in New Issue