This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
launcher.py
64 lines (44 loc) · 1.64 KB
/
launcher.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
# -*- coding: utf-8 -*-
import json
import os
import sys
def launch():
if sys.version_info[0] < 3:
print("Python version 3 or higher required.")
# cannot use debug.end here since it may not be installed.
input("Press enter to exit.")
raise SystemExit()
try:
import discord
from discord.ext import commands
import sqlite3
except ImportError as e:
print("Dependency error: {}".format(e))
# cannot use debug.end here since it may not be installed.
input("Press enter to exit.")
raise SystemExit()
try:
with open("config.json") as f:
config = json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
with open("config.json", "w") as f:
model = {"token": "", "default_prefix": "$", "description": "", "bot_owners":[]}
json.dump(model, f, indent=4)
with open("config.json") as f:
config = json.load(f)
print("Please enter configuration parameters.")
if config["token"] is "":
config["token"] = input("TOKEN: ")
if len(config["bot_owners"]) < 1:
for i in input("BOT OWNERS (split by ','): ").replace(" ", "").split(","):
if input("Add id '{}' as bot owner? (y/n): ".format(i)).lower() == "y":
config["bot_owners"].append(i)
print("Added id '{}' to bot owners list.".format(i))
else:
print("Skipping id '{}'.".format(i))
with open("config.json", "w+") as f:
json.dump(config, f, indent=4)
from bot import Sparks
Sparks()
if __name__ == "__main__":
launch()