Add DEV_CHANNEL and send tracebacks there instead
Per @skizzerz, tracebacks can reveal potentially sensitive game info. Therefore, I added an option to send the tracebacks to an alternate channel instead. You can even send them only to voiced or opped users.
This commit is contained in:
parent
0ebb4d5e36
commit
1cc6d411f8
@ -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 = ""
|
||||
|
@ -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")
|
||||
|
Loading…
x
Reference in New Issue
Block a user