Fix PEP8 compliance in example plugins and rtmbot
This commit is contained in:
parent
6052333c64
commit
25ce082eac
6 changed files with 33 additions and 22 deletions
|
@ -1,8 +1,9 @@
|
|||
import time
|
||||
outputs = []
|
||||
|
||||
|
||||
def canary():
|
||||
#NOTE: you must add a real channel ID for this to work
|
||||
# NOTE: you must add a real channel ID for this to work
|
||||
outputs.append(["D12345678", "bot started: " + str(time.time())])
|
||||
|
||||
canary()
|
||||
|
|
|
@ -2,8 +2,9 @@ import time
|
|||
crontable = []
|
||||
outputs = []
|
||||
|
||||
crontable.append([5,"say_time"])
|
||||
crontable.append([5, "say_time"])
|
||||
|
||||
|
||||
def say_time():
|
||||
#NOTE: you must add a real channel ID for this to work
|
||||
# NOTE: you must add a real channel ID for this to work
|
||||
outputs.append(["D12345678", time.time()])
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import time
|
||||
crontable = []
|
||||
outputs = []
|
||||
|
||||
|
||||
def process_message(data):
|
||||
if data['channel'].startswith("D"):
|
||||
outputs.append([data['channel'], "from repeat1 \"{}\" in channel {}".format(data['text'], data['channel']) ])
|
||||
|
||||
outputs.append([data['channel'], "from repeat1 \"{}\" in channel {}".format(
|
||||
data['text'], data['channel'])]
|
||||
)
|
||||
|
|
|
@ -6,19 +6,21 @@ crontabs = []
|
|||
|
||||
tasks = {}
|
||||
|
||||
FILE="plugins/todo.data"
|
||||
|
||||
FILE = "plugins/todo.data"
|
||||
if os.path.isfile(FILE):
|
||||
tasks = pickle.load(open(FILE, 'rb'))
|
||||
|
||||
|
||||
def process_message(data):
|
||||
global tasks
|
||||
channel = data["channel"]
|
||||
text = data["text"]
|
||||
#only accept tasks on DM channels
|
||||
# only accept tasks on DM channels
|
||||
if channel.startswith("D"):
|
||||
if channel not in tasks.keys():
|
||||
tasks[channel] = []
|
||||
#do command stuff
|
||||
# do command stuff
|
||||
if text.startswith("todo"):
|
||||
tasks[channel].append(text[5:])
|
||||
outputs.append([channel, "added"])
|
||||
|
@ -36,4 +38,4 @@ def process_message(data):
|
|||
tasks[channel].pop(num)
|
||||
if text == "show":
|
||||
print tasks
|
||||
pickle.dump(tasks, open(FILE,"wb"))
|
||||
pickle.dump(tasks, open(FILE, "wb"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue