Compare commits

..

No commits in common. "6d4717e4711536e4dd3140ba13d4cc67e81577df" and "f35f32110e91f0feafcca30dca5386e07a2df55f" have entirely different histories.

2 changed files with 3 additions and 20 deletions

1
.gitignore vendored
View file

@ -161,4 +161,3 @@ cython_debug/
#.idea/
config
db

View file

@ -1,7 +1,7 @@
import json
import discord
import os
import sqlite3
import psycopg2
class Bot(discord.Client):
async def on_ready(self):
@ -20,24 +20,8 @@ class Bot(discord.Client):
class Cert():
def __init__(self):
if not os.path.isfile("./db/dislocker.db"):
initial = 1
else:
initial = 0
self.db = sqlite3.connect("./db/dislocker.db")
if initial == 1:
self.initial()
def initial(self):
cursor = self.db.cursor()
initial_sql_web_auth = "CREATE TABLE web_auth (id INTEGER PRIMARY KEY AUTOINCREMENT, username VARCHAR(10) NOT NULL, password VARCHAR(32) NOT NULL);"
cursor.execute(initial_sql_web_auth)
initial_sql_discord_user = "CREATE TABLE discord_user (id INTEGER PRIMARY KEY AUTOINCREMENT, discord_username VARCHAR(32) NOT NULL, discord_userid VARCHAR(18) NOT NULL);"
cursor.execute(initial_sql_discord_user)
initial_sql_insert_web_admin = "INSERT INTO discord_user (username, password) VALUES ('admin', 'admin');"
cursor.execute(initial_sql_insert_web_admin)
self.db.commit()
self.db = psycopg2.connect("host=localhost dbname=dislocker user=suti7 password=testing")
def register(self, username, userid):
cursor = self.db.cursor()
insert_sql = "INSERT INTO user_list (discord_username, discord_userid) VALUES (%s, %s);"