aboutsummaryrefslogtreecommitdiff
path: root/modules/print_activity.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-05-02 10:24:01 +0100
committerGravatar jesopo2019-05-02 10:24:01 +0100
commit1a2309e4fccf39a5d5d7e81b63bb64d42e6e7a7b (patch)
treed9b44a0e39f32662f8e4580b27815360cf3a8176 /modules/print_activity.py
parentFix reconnect() type hint issues (diff)
signature
add 'print-motd' bot setting, to enable/disable printing motd to log
Diffstat (limited to 'modules/print_activity.py')
-rw-r--r--modules/print_activity.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/modules/print_activity.py b/modules/print_activity.py
index 7f0d3777..0aaf583a 100644
--- a/modules/print_activity.py
+++ b/modules/print_activity.py
@@ -1,7 +1,14 @@
import datetime
from src import EventManager, ModuleManager, utils
+@utils.export("botset", {"setting": "print-motd",
+ "help": "Set whether I print /motd", "validate": utils.bool_or_none})
class Module(ModuleManager.BaseModule):
+ def _print(self, event):
+ self.bot.log.info("%s%s | %s", [
+ str(event["server"]), event["context"] or "",
+ utils.irc.parse_format(event["line"])])
+
@utils.hook("formatted.message.channel")
@utils.hook("formatted.notice.channel")
@utils.hook("formatted.notice.private")
@@ -16,8 +23,10 @@ class Module(ModuleManager.BaseModule):
@utils.hook("formatted.kick")
@utils.hook("formatted.quit")
@utils.hook("formatted.rename")
- @utils.hook("formatted.motd")
def formatted(self, event):
- self.bot.log.info("%s%s | %s", [
- str(event["server"]), event["context"] or "",
- utils.irc.parse_format(event["line"])])
+ self._print(event)
+
+ @utils.hook("formatted.motd")
+ def motd(self, event):
+ if self.bot.get_setting("print-motd", True):
+ self._print(event)