2019-05-25 20:40:06 +00:00
|
|
|
#--depends-on config
|
|
|
|
#--depends-on format_activity
|
|
|
|
|
2018-07-15 13:14:20 +00:00
|
|
|
import datetime
|
2018-10-03 12:22:37 +00:00
|
|
|
from src import EventManager, ModuleManager, utils
|
2018-07-15 13:14:20 +00:00
|
|
|
|
2019-06-28 22:16:05 +00:00
|
|
|
@utils.export("botset",
|
|
|
|
utils.BoolSetting("print-motd", "Set whether I print /motd"))
|
2019-11-14 11:48:51 +00:00
|
|
|
@utils.export("botset", utils.BoolSetting("pretty-activity",
|
|
|
|
"Whether or not to pretty print activity"))
|
2019-11-14 13:25:41 +00:00
|
|
|
@utils.export("channelset", utils.BoolSetting("print",
|
|
|
|
"Whether or not to print activity a channel to logs"))
|
2018-09-27 10:46:10 +00:00
|
|
|
class Module(ModuleManager.BaseModule):
|
2019-05-02 09:24:01 +00:00
|
|
|
def _print(self, event):
|
2019-11-14 13:25:41 +00:00
|
|
|
if (event["channel"] and
|
|
|
|
not event["channel"].get_setting("print", True)):
|
|
|
|
return
|
|
|
|
|
2019-11-14 11:48:51 +00:00
|
|
|
line = event["line"]
|
2019-11-14 11:55:59 +00:00
|
|
|
if event["pretty"] and self.bot.get_setting("pretty-activity", False):
|
2019-11-14 11:48:51 +00:00
|
|
|
line = event["pretty"]
|
|
|
|
|
2019-11-19 17:23:00 +00:00
|
|
|
context = (":%s" % event["context"]) if event["context"] else ""
|
2019-05-02 09:24:01 +00:00
|
|
|
self.bot.log.info("%s%s | %s", [
|
2019-11-19 17:23:00 +00:00
|
|
|
str(event["server"]), context, utils.irc.parse_format(line)])
|
2019-05-02 09:24:01 +00:00
|
|
|
|
2019-03-05 09:19:06 +00:00
|
|
|
@utils.hook("formatted.message.channel")
|
|
|
|
@utils.hook("formatted.notice.channel")
|
2019-03-06 08:08:40 +00:00
|
|
|
@utils.hook("formatted.notice.private")
|
2019-03-05 09:19:06 +00:00
|
|
|
@utils.hook("formatted.join")
|
|
|
|
@utils.hook("formatted.part")
|
|
|
|
@utils.hook("formatted.nick")
|
|
|
|
@utils.hook("formatted.server-notice")
|
|
|
|
@utils.hook("formatted.invite")
|
|
|
|
@utils.hook("formatted.mode.channel")
|
|
|
|
@utils.hook("formatted.topic")
|
|
|
|
@utils.hook("formatted.topic-timestamp")
|
|
|
|
@utils.hook("formatted.kick")
|
|
|
|
@utils.hook("formatted.quit")
|
|
|
|
@utils.hook("formatted.rename")
|
2019-10-31 15:35:53 +00:00
|
|
|
@utils.hook("formatted.chghost")
|
2019-03-05 09:19:06 +00:00
|
|
|
def formatted(self, event):
|
2019-05-02 09:24:01 +00:00
|
|
|
self._print(event)
|
|
|
|
|
|
|
|
@utils.hook("formatted.motd")
|
|
|
|
def motd(self, event):
|
|
|
|
if self.bot.get_setting("print-motd", True):
|
|
|
|
self._print(event)
|