-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.py
73 lines (55 loc) · 2.13 KB
/
install.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import pathlib
from dotenv import load_dotenv
from sql.database import Database
root_dir = pathlib.Path(__file__).parent
def create_db():
db = Database()
sql = (
"create table config_global ("
"bot_token varchar(100),"
"admins_global LONGTEXT"
");"
)
db.execute(sql)
print("Created global config table")
sql = """create table config_guilds
(
id int auto_increment,
guild_id BIGINT null,
guild_captcha_channel BIGINT null,
guild_captcha_role BIGINT null,
guild_captcha_last_msg BIGINT null,
guild_captcha_background_color varchar(100) default '255, 0, 255' not null,
guild_captcha_text_color varchar(100) default '90, 90, 90' not null,
guild_captcha_embed_title longtext default 'Beep-Boop, are you human?' null,
guild_captcha_embed_description longtext default 'Hit the button below to verify yourself' null,
guild_captcha_enabled bit default 0 not null,
guild_captcha_timeout int default 7 not null,
guild_log_retention int default 30 not null,
guild_admins longtext null,
constraint config_guilds_pk
primary key (id)
);
"""
db.execute(sql)
print("Created guild config table")
sql = """
create table guild_logs (
id int auto_increment,
guild_id bigint null,
log_level varchar(100),
log_date_added datetime,
log_content longtext,
constraint guild_logs_pk
primary key (id)
)
"""
db.execute(sql)
print("Created guild logs table")
bot_token = input("Bot token please: ")
sql = "insert into config_global (bot_token, admins_global) values (%(token)s, %(admins)s)"
db.execute(sql, {"token": bot_token, "admins": ""})
db.close()
if __name__ == "__main__":
load_dotenv()
create_db()