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

Commit f9f2fd5

Browse files
authored
Merge pull request #79 from theist/patch-1
Corrected markdown headings
2 parents 1d28f68 + b05b73e commit f9f2fd5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The repeat plugin will now be loaded by the bot on startup. Run `rtmbot` from co
115115
Create Plugins
116116
--------
117117

118-
####Incoming data
118+
#### Incoming data
119119
All events from the RTM websocket are sent to the registered plugins. To act on an event, create a function definition, inside your Plugin class, called process_(api_method) that accepts a single arg for data. For example, to handle incoming messages:
120120

121121
def process_message(self, data):
@@ -129,17 +129,17 @@ For a list of all possible API Methods, look here: https://api.slack.com/rtm
129129

130130
Note: If you're using Python 2.x, the incoming data should be a unicode string, be careful you don't coerce it into a normal str object as it will cause errors on output. You can add `from __future__ import unicode_literals` to your plugin file to avoid this.
131131

132-
####Outgoing data
132+
#### Outgoing data
133133

134-
#####RTM Output
134+
##### RTM Output
135135
Plugins can send messages back to any channel or direct message. This is done by appending a two item array to the Plugin's output array (```myPluginInstance.output```). The first item in the array is the channel or DM ID and the second is the message text. Example that writes "hello world" when the plugin is started:
136136

137137
class myPlugin(Plugin):
138138

139139
def process_message(self, data):
140140
self.outputs.append(["C12345667", "hello world"])
141141

142-
#####SlackClient Web API Output
142+
##### SlackClient Web API Output
143143
Plugins also have access to the connected SlackClient instance for more complex output (or to fetch data you may need).
144144

145145
def process_message(self, data):
@@ -148,7 +148,7 @@ Plugins also have access to the connected SlackClient instance for more complex
148148
username="pybot", icon_emoji=":robot_face:"
149149

150150

151-
####Timed jobs
151+
#### Timed jobs
152152
Plugins can also run methods on a schedule. This allows a plugin to poll for updates or perform housekeeping during its lifetime. Jobs define a run() method and return any outputs to be sent to channels. They also have access to a SlackClient instance that allows them to make calls to the Slack Web API.
153153

154154
For example, this will print "hello world" every 10 seconds. You can output multiple messages two the same or different channels by passing multiple pairs of [Channel, Message] combos.
@@ -169,5 +169,5 @@ For example, this will print "hello world" every 10 seconds. You can output mult
169169
self.jobs.append(job)
170170

171171

172-
####Plugin misc
172+
#### Plugin misc
173173
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.

0 commit comments

Comments
 (0)