Update server.py
This commit is contained in:
parent
6c3a9b70a5
commit
34d71f3aa3
1 changed files with 9 additions and 1 deletions
10
server.py
10
server.py
|
@ -2,7 +2,7 @@
|
||||||
__version__ = "0.0.1-pre-alpha"
|
__version__ = "0.0.1-pre-alpha"
|
||||||
print(f"INTERNET RELAY CAT v{__version__}")
|
print(f"INTERNET RELAY CAT v{__version__}")
|
||||||
print("Welcome! /ᐠ ˵> ⩊ <˵マ")
|
print("Welcome! /ᐠ ˵> ⩊ <˵マ")
|
||||||
import socket, time, threading, traceback, sys, subprocess, yaml
|
import socket, time, threading, traceback, sys, subprocess, yaml, sqlite3
|
||||||
from requests import get
|
from requests import get
|
||||||
if not len(sys.argv) == 2:
|
if not len(sys.argv) == 2:
|
||||||
print("IRCat requires the following arguments: config.yml")
|
print("IRCat requires the following arguments: config.yml")
|
||||||
|
@ -10,6 +10,8 @@ if not len(sys.argv) == 2:
|
||||||
server = "127.0.0.1"
|
server = "127.0.0.1"
|
||||||
displayname = "foo"
|
displayname = "foo"
|
||||||
identifier = "somewhere in the universe"
|
identifier = "somewhere in the universe"
|
||||||
|
admin_nick = "admin"
|
||||||
|
data_path = ""
|
||||||
with open(sys.argv[1], 'r') as file:
|
with open(sys.argv[1], 'r') as file:
|
||||||
data = yaml.safe_load(file)
|
data = yaml.safe_load(file)
|
||||||
try: server = data["host"]
|
try: server = data["host"]
|
||||||
|
@ -18,6 +20,12 @@ with open(sys.argv[1], 'r') as file:
|
||||||
except: print("using fallback display name")
|
except: print("using fallback display name")
|
||||||
try: identifier = data["identifier"]
|
try: identifier = data["identifier"]
|
||||||
except: print("using fallback identifier")
|
except: print("using fallback identifier")
|
||||||
|
try: admin_nick = data["admin-nick"]
|
||||||
|
except: print("using fallback admin nick")
|
||||||
|
try: data_path = data["data-path"]
|
||||||
|
except:
|
||||||
|
print("IRCat requires \"data-path\" in config.yml")
|
||||||
|
sys.exit(1)
|
||||||
file.close()
|
file.close()
|
||||||
print("Successfully loaded config!")
|
print("Successfully loaded config!")
|
||||||
ip = get('https://api.ipify.org').content.decode('utf8')
|
ip = get('https://api.ipify.org').content.decode('utf8')
|
||||||
|
|
Loading…
Reference in a new issue