forked from tildeverse/tilde.chat
skip channels with +s
This commit is contained in:
parent
c2fc0237fe
commit
e489171e37
10
gen_stats
10
gen_stats
|
@ -12,6 +12,7 @@ assert d.tag == "inspircdstats"
|
||||||
with open(f"{WORK_DIR}/blacklist", "r") as f:
|
with open(f"{WORK_DIR}/blacklist", "r") as f:
|
||||||
BLACKLIST = f.read().splitlines()
|
BLACKLIST = f.read().splitlines()
|
||||||
|
|
||||||
|
|
||||||
def define(name, xps, vfilter=lambda x: x):
|
def define(name, xps, vfilter=lambda x: x):
|
||||||
global out
|
global out
|
||||||
out[name] = vfilter(d.findall(xps)[0].text)
|
out[name] = vfilter(d.findall(xps)[0].text)
|
||||||
|
@ -32,15 +33,14 @@ for schannel in schannels:
|
||||||
if schannel.findall("./channeltopic/topictext")[0].text is not None
|
if schannel.findall("./channeltopic/topictext")[0].text is not None
|
||||||
else "No topic set"
|
else "No topic set"
|
||||||
)
|
)
|
||||||
# bugfix: if mode s is set and there's a topic, hide the topic
|
|
||||||
if (
|
if (
|
||||||
|
# skip channels in the blacklist or with mode +s
|
||||||
"s" in schannel.findall("./channelmodes")[0].text.split()[0]
|
"s" in schannel.findall("./channelmodes")[0].text.split()[0]
|
||||||
and channel["topic"] != "No topic set"
|
or channel["name"] in BLACKLIST
|
||||||
):
|
):
|
||||||
channel["topic"] = "Topic hidden"
|
|
||||||
if channel["name"] in BLACKLIST:
|
|
||||||
# skip channels in the blacklist
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
channel["webchatlink"] = "https://web.tilde.chat/?join=" + channel["name"].lstrip(
|
channel["webchatlink"] = "https://web.tilde.chat/?join=" + channel["name"].lstrip(
|
||||||
"#"
|
"#"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue