From 5e7daffadbd523e1d2a457d10977b1c8a2880d9d Mon Sep 17 00:00:00 2001 From: Jeff Ammons Date: Thu, 25 Aug 2016 15:35:37 -0700 Subject: [PATCH] Add a bit more info into the example plugin. --- docs/example-plugins/directAPIcall.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/example-plugins/directAPIcall.py b/docs/example-plugins/directAPIcall.py index 30d82a0..9e4e52d 100644 --- a/docs/example-plugins/directAPIcall.py +++ b/docs/example-plugins/directAPIcall.py @@ -1,5 +1,11 @@ from __future__ import unicode_literals from client import slack_client as sc -for user in sc.api_call("users.list")["members"]: - print(user["name"], user["id"]) + +def process_message(data): + '''If a user passes 'print users' in a message, print the users in the slack + team to the console. (Don't run this in production probably)''' + + if 'print users' in data['text']: + for user in sc.api_call("users.list")["members"]: + print(user["name"], user["id"])