49 lines
1.4 KiB
Python
49 lines
1.4 KiB
Python
import yaml
|
|
import sys
|
|
|
|
# Load configuration from config.yml
|
|
try:
|
|
with open("config.yml", "r") as file:
|
|
config = yaml.safe_load(file)
|
|
except FileNotFoundError:
|
|
print("[-] Configuration file not found.")
|
|
exit(1)
|
|
except yaml.YAMLError as e:
|
|
print(f"[-] Error parsing configuration file: {e}")
|
|
exit(1)
|
|
except Exception as e:
|
|
print(f"[-] Failed to load config.yml: {e}")
|
|
sys.exit(1)
|
|
|
|
# Bot setup for IRC
|
|
SERVER = config["irc"]["server"]
|
|
PORT = config["irc"]["port"]
|
|
BOTNICK = config["irc"]["botnick"]
|
|
NICKSERV_USER = config["irc"]["nickserv_user"]
|
|
NICKSERV_PASS = config["irc"]["nickserv_pass"]
|
|
OPER_USER = config["irc"]["oper_user"]
|
|
OPER_PASS = config["irc"]["oper_pass"]
|
|
|
|
# Channel setups
|
|
LOBBY_CHANNEL = config["irc"]["lobby_chat"]
|
|
MAIN_CHANNEL = config["irc"].get("main_chat", "#lobby")
|
|
ADMIN_CHANNEL = config["irc"].get("admin_chat", "#admins")
|
|
STAFF_CHANNELS = list(config["irc"].get("staff_chats", {}).values())
|
|
|
|
# API setup
|
|
API_ENDPOINT = config["api"]["endpoint"]
|
|
API_TOKEN = config["api"]["token"]
|
|
VERIFY_ENDPOINT = config["api"]["verify_endpoint"]
|
|
|
|
# Flask settings
|
|
RECONNECT_DELAY = config["settings"].get("reconnect_delay", 8)
|
|
FLASK_PORT = config["settings"].get("flask_port", 5150)
|
|
|
|
# Redis settings
|
|
REDIS_PW = config["redis"]["redis_pw"]
|
|
|
|
# Groups info
|
|
GROUP_NAMES = config.get("groups", {})
|
|
STAFF_GROUP_IDS = set(config.get("staff_group_ids", []))
|
|
ADMIN_GROUP_IDS = set(config.get("admin_group_ids", []))
|