Per-server hosts

This commit is contained in:
Firepup Sixfifty 2023-11-14 22:36:55 -06:00
parent 75278707bb
commit 7ff4a6169b
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA

View file

@ -17,22 +17,26 @@ servers: dict[str, dict[str, Any]] = {
"pass": env["ircnow_pass"], "pass": env["ircnow_pass"],
"channels": {"#random": 0, "#dice": 0, "#offtopic": 0}, "channels": {"#random": 0, "#dice": 0, "#offtopic": 0},
"admins": ["firepup", "h|thelounge", "firepup|lounge"], "admins": ["firepup", "h|thelounge", "firepup|lounge"],
"hosts": [],
}, },
"efnet": { "efnet": {
"address": "irc.mzima.net", "address": "irc.mzima.net",
"channels": {"#random": 0, "#dice": 0}, "channels": {"#random": 0, "#dice": 0},
"admins": ["firepup", "h|tl", "fire|tl"], "admins": ["firepup", "h|tl", "fire|tl"],
"hosts": [],
}, },
"replirc": { "replirc": {
"address": "localhost", "address": "localhost",
"pass": env["replirc_pass"], "pass": env["replirc_pass"],
"channels": {"#random": 0, "#dice": 0, "#main": 0, "#bots": 0, "#firebot": 0}, "channels": {"#random": 0, "#dice": 0, "#main": 0, "#bots": 0, "#firebot": 0},
"admins": ["firepup", "firepup|lounge", "h|tl"], "admins": ["firepup", "firepup|lounge", "h|tl"],
"hosts": [],
}, },
"backupbox": { "backupbox": {
"address": "172.23.11.5", "address": "172.23.11.5",
"channels": {"#default": 0}, "channels": {"#default": 0},
"admins": [] "admins": [],
"hosts": ["172.20.171.225", "169.254.253.107"],
} }
} }
admin_hosts: list[str] = ["firepup.firepi", "owner.firepi", "47.221.227.180"] admin_hosts: list[str] = ["firepup.firepi", "owner.firepi", "47.221.227.180"]
@ -64,4 +68,4 @@ def mfind(message: str, find: list, usePrefix: bool = True) -> bool:
return any(message[: len(match)] == match for match in find) return any(message[: len(match)] == match for match in find)
def adminCheck(bot: bare.bot, name: str, host: Optional[str] = "nul") -> bool: def adminCheck(bot: bare.bot, name: str, host: Optional[str] = "nul") -> bool:
return name in servers[bot.server]["admins"] or host in admin_hosts return name in servers[bot.server]["admins"] or host in admin_hosts or host in servers[bot.server]["hosts"]