Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _expired(self, last, now):
return now - last > self.warn_every
def warn(self, nick, connection):
if pmxbot.config.get('privacy warning') == 'suppress':
return
if not self.needs_warning(nick):
return
logged_channels_string = ', '.join(pmxbot.config.log_channels)
msg = self.warn_message.format(**locals())
for line in msg.splitlines():
connection.notice(nick, line)
class Scheduler(tempora.schedule.CallbackScheduler, irc.schedule.DefaultScheduler):
pass
class LoggingCommandBot(core.Bot, irc.bot.SingleServerIRCBot):
def __init__(self, server, port, nickname, channels, password=None):
ErrorReportingBuffer.install()
server_list = [(server, port, password)]
super().__init__(server_list, nickname, nickname)
self.reactor.scheduler = Scheduler(dispatch=self.handle_scheduled)
self.nickname = nickname
self._channels = channels
self._nickname = nickname
self.warn_history = WarnHistory()
def connect(self, *args, **kwargs):
factory = irc.connection.Factory(wrapper=self._get_wrapper())
def __init__(self, server, port, nickname, channels, password=None):
token = pmxbot.config['slack token']
sc = importlib.import_module('slackclient')
self.slack = sc.SlackClient(token)
sr = importlib.import_module('slacker')
self.slacker = sr.Slacker(token)
self.scheduler = schedule.CallbackScheduler(self.handle_scheduled)