Removing non-PEP8 changes to clean up PR

This commit is contained in:
Jeff Ammons 2016-04-15 12:40:27 -07:00
parent aff0446b8f
commit 6052333c64
2 changed files with 8 additions and 5 deletions

View file

@ -3,4 +3,3 @@ python-daemon
pyyaml pyyaml
websocket-client websocket-client
slackclient slackclient
deamon

View file

@ -7,7 +7,6 @@ sys.dont_write_bytecode = True
import glob import glob
import yaml import yaml
import os import os
import sys
import time import time
import logging import logging
from argparse import ArgumentParser from argparse import ArgumentParser
@ -66,6 +65,9 @@ class RtmBot(object):
if channel is not None and output[1] is not None: if channel is not None and output[1] is not None:
if limiter: if limiter:
time.sleep(.1) 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 ? limiter = True # TODO: check goal: no sleep for 1st channel, sleep of all after ?
# TODO: find out how to safely encode stuff if needed :( # TODO: find out how to safely encode stuff if needed :(
# message = output[1].encode('utf-8','ignore') # message = output[1].encode('utf-8','ignore')
@ -89,7 +91,9 @@ class RtmBot(object):
# print "error loading plugin %s" % name # print "error loading plugin %s" % name
class Plugin(object): 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.name = name
self.jobs = [] self.jobs = []
self.module = __import__(name) self.module = __import__(name)
@ -115,11 +119,11 @@ class Plugin(object):
# this makes the plugin fail with stack trace in debug mode # this makes the plugin fail with stack trace in debug mode
if not debug: if not debug:
try: try:
eval("self.module." + function_name)(data, bot, config) eval("self.module." + function_name)(data)
except: except:
dbg("problem in module {} {}".format(function_name, data)) dbg("problem in module {} {}".format(function_name, data))
else: else:
eval("self.module." + function_name)(data, bot, config) eval("self.module." + function_name)(data)
if "catch_all" in dir(self.module): if "catch_all" in dir(self.module):
try: try:
self.module.catch_all(data) self.module.catch_all(data)