diff --git a/botconfig.py.example b/botconfig.py.example index 7feb758..ace580e 100644 --- a/botconfig.py.example +++ b/botconfig.py.example @@ -33,5 +33,8 @@ USE_UTC = True # if True, will use the UTC time, else the local time # %Y is the year with century, %y is the year without, %m is the month, %d the day, %H hour, %M minute and %S seconds TIMESTAMP_FORMAT = "[%Y-%m-%d %H:%M:%S{tzoffset}]" -# If enabled, when an exception is caught, the bot will post it to termbin.com and post the link to the channel. -PASTEBIN_ERRORS = True +# If enabled and DEV_CHANNEL is set, the bot will post tracebacks there. +PASTEBIN_ERRORS = False + +# Channel(s) where errors will be sent to. Can be prefixed with '+' or '@' for sending to only voices or ops. +DEV_CHANNEL = "" diff --git a/modules/common.py b/modules/common.py index e40d334..d00132d 100644 --- a/modules/common.py +++ b/modules/common.py @@ -21,7 +21,9 @@ def notify_error(cli, chan, target_logger): target_logger(tb) - if botconfig.PASTEBIN_ERRORS: + cli.msg(chan, msg) + + if botconfig.PASTEBIN_ERRORS and botconfig.DEV_CHANNEL: try: with socket.socket() as sock: sock.connect(("termbin.com", 9999)) @@ -30,10 +32,7 @@ def notify_error(cli, chan, target_logger): except socket.error: target_logger(traceback.format_exc()) else: - msg += " " - msg += url - - cli.msg(chan, msg) + cli.msg(botconfig.DEV_CHANNEL, " ".join((msg, url))) def on_privmsg(cli, rawnick, chan, msg, notice = False): @@ -110,6 +109,7 @@ def connect_callback(cli): def prepare_stuff(*args): cli.join(botconfig.CHANNEL) cli.join(botconfig.ALT_CHANNELS) + cli.join(",".join(chan.lstrip("@+") for chan in botconfig.DEV_CHANNEL.split(","))) cli.msg("ChanServ", "op "+botconfig.CHANNEL) cli.cap("REQ", "extended-join")