0.3.9.2.a8
This commit is contained in:
parent
c28bc573cc
commit
4d5258c89d
23
bot.py
23
bot.py
@ -9,7 +9,7 @@ from modules.common.boot_notice import post_boot_notice
|
|||||||
|
|
||||||
# Version consists of:
|
# Version consists of:
|
||||||
# Major.Enhancement.Minor.Patch.Test (Test is alphanumeric; doesn’t trigger auto update)
|
# Major.Enhancement.Minor.Patch.Test (Test is alphanumeric; doesn’t trigger auto update)
|
||||||
VERSION = "0.3.9.2.a7"
|
VERSION = "0.3.9.2.a8"
|
||||||
|
|
||||||
# ---------- Env loading ----------
|
# ---------- Env loading ----------
|
||||||
|
|
||||||
@ -56,28 +56,31 @@ async def _guild_selfcheck(g: discord.Guild, c):
|
|||||||
problems = []
|
problems = []
|
||||||
|
|
||||||
def _need_channel(id_key, *perms):
|
def _need_channel(id_key, *perms):
|
||||||
raw = c.get(id_key)
|
# Use typed accessor; falls back to default=0 if unset/invalid
|
||||||
if not raw:
|
cid = 0
|
||||||
problems.append(f"Missing config key: {id_key}")
|
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
cid = int(raw)
|
cid = int(c.int(id_key, 0))
|
||||||
except Exception:
|
except Exception:
|
||||||
problems.append(f"Bad channel id for {id_key}: {raw}")
|
cid = 0
|
||||||
|
|
||||||
|
if not cid:
|
||||||
|
problems.append(f"Missing config key: {id_key}\n")
|
||||||
return
|
return
|
||||||
|
|
||||||
ch = g.get_channel(cid)
|
ch = g.get_channel(cid)
|
||||||
if not ch:
|
if not ch:
|
||||||
problems.append(f"Channel not found: {id_key}={cid}")
|
problems.append(f"Channel not found: {id_key}={cid}")
|
||||||
return
|
return
|
||||||
|
|
||||||
me = g.me
|
me = g.me
|
||||||
p = ch.permissions_for(me)
|
p = ch.permissions_for(me)
|
||||||
for perm in perms:
|
for perm in perms:
|
||||||
if not getattr(p, perm, False):
|
if not getattr(p, perm, False):
|
||||||
problems.append(f"Missing permission on #{ch.name}: {perm}")
|
problems.append(f"Missing permission on #{ch.name}: {perm}")
|
||||||
|
|
||||||
_need_channel("mod_channel_id", "read_messages", "send_messages", "add_reactions", "read_message_history")
|
_need_channel('mod_channel_id', 'read_messages', 'send_messages', 'add_reactions', 'read_message_history')
|
||||||
_need_channel("modlog_channel_id", "read_messages", "send_messages")
|
_need_channel('modlog_channel_id', 'read_messages', 'send_messages')
|
||||||
_need_channel("pirates_list_channel_id", "read_messages", "send_messages")
|
_need_channel('pirates_list_channel_id', 'read_messages', 'send_messages')
|
||||||
|
|
||||||
if problems:
|
if problems:
|
||||||
print(f"[SelfCheck:{g.name}]")
|
print(f"[SelfCheck:{g.name}]")
|
||||||
|
Loading…
Reference in New Issue
Block a user