forked from TheRealRhyle/TwitchBot_full_rebuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.py
52 lines (43 loc) · 1.39 KB
/
installer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sqlite3
global conn
global c
conn = sqlite3.connect("dxchatbot.db")
c = conn.cursor()
def installbot(host, nick, port, pwd):
conn = sqlite3.connect("dxchatbot.db")
readbuff = ''
c = conn.cursor()
c.execute("""create table streamer (
host text,
nick text,
port integer,
pass text,
readbuffer text)""")
conn.commit()
c.execute("insert into streamer values (:host, :nick, :port, :pwd, :readbuff)",
{'host':host, 'nick':nick, 'port':port, 'pwd':pwd, 'readbuff':readbuff})
conn.commit()
oput = c.execute('select * from streamer').fetchall()
print(oput)
conn.close()
print("Database has been created for " + nick + '.')
def build_tables():
c.execute("""create table mods_subs (
uname text,
status text)""")
c.execute("""create table commands (
ex_command text,
target text,
action text)""")
conn.commit()
def reinstall(host, nick, port, pwd):
conn = sqlite3.connect("dxchatbot.db")
readbuff = ''
c = conn.cursor()
c.execute("drop table streamer")
conn.commit()
installbot(host, nick, port, pwd)
if __name__ == '__main__':
build_tables()
print(c.execute("select * from mods_subs").fetchall())
print(c.execute("select * from commands").fetchall())