mirror of https://github.com/9001/r0c.git
add `--motd` (customizable welcome-text)
This commit is contained in:
parent
ff55d39baf
commit
f6d4c51840
|
@ -68,6 +68,7 @@ def optgen(ap, pwd):
|
|||
|
||||
ac = ap.add_argument_group("ux")
|
||||
ac.add_argument("--no-all", action="store_true", help="default-disable @all / @everyone")
|
||||
ac.add_argument("--motd", metavar="PATH", type=u, default="", help="file to include at the end of the welcome-text (can be edited at runtime)")
|
||||
|
||||
ac = ap.add_argument_group("perf")
|
||||
ac.add_argument("--hist-rd", metavar="N", type=int, default=65535, help="max num msgs to load from disk when joining a channel")
|
||||
|
|
|
@ -172,6 +172,14 @@ class User(object):
|
|||
)
|
||||
text += HELP_INTRO
|
||||
|
||||
if self.ar.motd:
|
||||
try:
|
||||
with open(self.ar.motd, "rb") as f:
|
||||
text += f.read().replace(b"\r", b"").decode("utf-8", "replace")[:-1]
|
||||
except Exception as ex:
|
||||
t = "WARNING: could not read motd-file [%s]: %s"
|
||||
print(t % (self.ar.motd, ex))
|
||||
|
||||
# x = u"`1;30m░▒▓█▀▀▀▀`37m█▀`46m▓`0;1;30m▀▀▀▀█▓▒░`0;36m┌ "
|
||||
# text += x.replace(u"`", u"\033[") * 66
|
||||
|
||||
|
|
Loading…
Reference in New Issue