From 6adcf4c482363d417e8984e70f67c9233f6da694 Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Tue, 14 Nov 2023 22:44:54 -0600 Subject: [PATCH] admin check from config, and import config itself rather than sub-parts for consistency --- commands.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/commands.py b/commands.py index c69f842..316fa33 100644 --- a/commands.py +++ b/commands.py @@ -1,5 +1,5 @@ from subprocess import run, PIPE -from config import npbase, su, decode_escapes +import config as conf import random as r from typing import Any, Callable import bare @@ -101,7 +101,7 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None: r.seed() mm = open("mastermessages.txt", "r") q = mm.readlines() - sel = decode_escapes(str(r.sample(q, 1)).strip("[]'").replace("\\n", "").strip('"')) + sel = conf.decode_escapes(str(r.sample(q, 1)).strip("[]'").replace("\\n", "").strip('"')) bot.msg(sel, chan) mm.close() @@ -143,7 +143,7 @@ def reboot(bot: bare.bot, chan: str, name: str, message: str) -> None: def sudo(bot: bare.bot, chan: str, name: str, message: str) -> None: - if name.lower() in bot.adminnames: + if conf.adminCheck(bot, name): bot.msg("Error - system failure, contact system operator", chan) elif "bot" in name.lower(): bot.log("lol, no.") @@ -179,13 +179,13 @@ data: dict[str, dict[str, Any]] = { "ping": {"prefix": True, "aliases": []}, "op me": {"prefix": False, "aliases": [], "admin": True}, } -checks: list[str] = [npbase, su] +checks: list[str] = [conf.npbase, conf.su] call: dict[str, Callable[[bare.bot, str, str, str], None]] = { "!botlist": botlist, "bugs bugs bugs": bugs, "hi $BOTNICK": hi, - npbase: nowplaying, - su: sudo, + conf.npbase: nowplaying, + conf.su: sudo, "restart": reboot, "uptime": uptime, "raw ": raw,