From 6052333c6482d7629c92776bd3b870fac30daaf2 Mon Sep 17 00:00:00 2001 From: Jeff Ammons Date: Fri, 15 Apr 2016 12:40:27 -0700 Subject: [PATCH] Removing non-PEP8 changes to clean up PR --- requirements.txt | 1 - rtmbot.py | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index ca595ee..d740102 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,3 @@ python-daemon pyyaml websocket-client slackclient -deamon diff --git a/rtmbot.py b/rtmbot.py index 59964a1..65c2668 100755 --- a/rtmbot.py +++ b/rtmbot.py @@ -7,7 +7,6 @@ sys.dont_write_bytecode = True import glob import yaml import os -import sys import time import logging from argparse import ArgumentParser @@ -66,6 +65,9 @@ class RtmBot(object): if channel is not None and output[1] is not None: if limiter: time.sleep(.1) + limiter = False + message = output[1].encode('ascii','ignore') + channel.send_message("{}".format(message)) limiter = True # TODO: check goal: no sleep for 1st channel, sleep of all after ? # TODO: find out how to safely encode stuff if needed :( # message = output[1].encode('utf-8','ignore') @@ -89,7 +91,9 @@ class RtmBot(object): # print "error loading plugin %s" % name class Plugin(object): - def __init__(self, name): + def __init__(self, name, plugin_config=None): + if plugin_config is None: + plugin_config = {} #TODO: is this necessary? self.name = name self.jobs = [] self.module = __import__(name) @@ -115,11 +119,11 @@ class Plugin(object): # this makes the plugin fail with stack trace in debug mode if not debug: try: - eval("self.module." + function_name)(data, bot, config) + eval("self.module." + function_name)(data) except: dbg("problem in module {} {}".format(function_name, data)) else: - eval("self.module." + function_name)(data, bot, config) + eval("self.module." + function_name)(data) if "catch_all" in dir(self.module): try: self.module.catch_all(data)