Skip to content
This repository was archived by the owner on Aug 15, 2022. It is now read-only.

Commit 9f71ca3

Browse files
committed
Documentation and Naming
Update Naming conventions and Docs
1 parent 1fb557b commit 9f71ca3

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,18 @@ Plugins can also run methods on a schedule. This allows a plugin to poll for upd
8989
####Plugin misc
9090
The data within a plugin persists for the life of the rtmbot process. If you need persistent data, you should use something like sqlite or the python pickle libraries.
9191

92+
####Direct API Calls
93+
You can directly call the Slack web API in your plugins by allowing the following import:
94+
95+
from client import client
96+
97+
You can also rename the client on import so it can be easily referenced like shown below:
98+
99+
from client import client as sc
100+
101+
Direct API calls can be called in your plugins in the following form:
102+
103+
sc.api_call("API.method", "parameters")
104+
92105
####Todo:
93106
Some rtm data should be handled upstream, such as channel and user creation. These should create the proper objects on-the-fly.

client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from slackclient import SlackClient
22
from rtmbot import RtmBot
33

4-
client = None
4+
slack_client = None
55

66
def init(config):
77
global client
88
bot = RtmBot(config)
9-
client = bot.slack_client
9+
slack_client = bot.slack_client
1010
return bot
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from __future__ import unicode_literals
2-
from client import client as sc
2+
from client import slack_client as sc
33

44
for user in sc.api_call("users.list")["members"]:
55
print(user["name"], user["id"])

0 commit comments

Comments
 (0)