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