summaryrefslogtreecommitdiff
path: root/motd.py
diff options
context:
space:
mode:
authorjomo <github@jomo.tv>2014-07-04 01:50:36 +0200
committerjomo <github@jomo.tv>2014-07-04 01:50:36 +0200
commit4791f843560cf7e73438779261233f4046dd93e1 (patch)
treea567b4788174de8951108755dceb61987fed7775 /motd.py
parent8ffa50c4369e4626cccd834b21bbed0a92527652 (diff)
add motd.py
Diffstat (limited to 'motd.py')
-rw-r--r--motd.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/motd.py b/motd.py
new file mode 100644
index 0000000..915fa63
--- /dev/null
+++ b/motd.py
@@ -0,0 +1,29 @@
+#pylint: disable=F0401
+from helpers import *
+
+motd = server.getMotd()
+
+@hook.command("getmotd")
+def onGetMotdCommand(sender, args):
+ plugHeader("MOTD")
+ msg(sender, motd, usecolor=False)
+
+
+@hook.command("setmotd")
+def onSetMotdCommand(sender, args):
+ global motd
+ plugHeader("MOTD")
+ if sender.hasPermission("utils.setmotd"):
+ if not checkargs(sender, args, 1, -1):
+ return True
+
+ motd = colorify(" ".join(args))
+ broadcast(plugHeader(name="MOTD"))
+ broadcast("&aNew MOTD:&r\n%s" % motd)
+ else:
+ noperm(sender)
+ return True
+
+@hook.event("server.ServerListPingEvent")
+def onServerPing(event):
+ event.setMotd(motd) \ No newline at end of file