You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added description text to 'channel.join' docs, fixed exposed markup in docs. (#147)
* Added description text to 'channel.join' docs
* Removed unneeded '..code-block' tags...
* Added '..code-block' tags, but correctly this time...
* Added highlight languages to code-block tags in README
* Added highlight languages to code-block tags in README, this time with proper newlines.
* Fixed a typo in README
* Use more verbose code-block formatting
* Regenerated docs
Copy file name to clipboardExpand all lines: README.rst
+21-12Lines changed: 21 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ If you get stuck, we’re here to help. The following are the best ways to get a
52
52
Documentation
53
53
--------------
54
54
55
-
For a comprehensive method information and usage examples, see the `full documentation <http://slackapi.github.io/python-slackclient>`_.
55
+
For comprehensive method information and usage examples, see the `full documentation <http://slackapi.github.io/python-slackclient>`_.
56
56
57
57
Basic Usage
58
58
------------
@@ -71,7 +71,8 @@ The primary use of Slack is sending messages. Whether you're sending a message
71
71
to a user or to a channel, this method handles both.
72
72
73
73
To send a message to a channel, use the channel's ID. For IMs, use the user's ID.
74
-
.. code-block::
74
+
75
+
.. code-block:: python
75
76
76
77
from slackclient import SlackClient
77
78
@@ -91,7 +92,8 @@ page for a full list of formatting and authorship options.
91
92
Deleting a message
92
93
********************
93
94
Sometimes you need to delete things.
94
-
..code-block::
95
+
96
+
.. code-block:: python
95
97
96
98
from slackclient import SlackClient
97
99
@@ -112,7 +114,8 @@ You can quickly respond to any message on Slack with an emoji reaction. Reaction
112
114
can be used for any purpose: voting, checking off to-do items, showing excitement — and just for fun.
113
115
114
116
This method adds a reaction (emoji) to an item (``file``, ``file comment``, ``channel message``, ``group message``, or ``direct message``). One of file, file_comment, or the combination of channel and timestamp must be specified.
115
-
..code-block::
117
+
118
+
.. code-block:: python
116
119
117
120
from slackclient import SlackClient
118
121
@@ -127,7 +130,8 @@ This method adds a reaction (emoji) to an item (``file``, ``file comment``, ``ch
127
130
)
128
131
129
132
Removing an emoji reaction is basically the same format, but you'll use ``reactions.remove`` instead of ``reactions.add``
130
-
..code-block::
133
+
134
+
.. code-block:: python
131
135
132
136
sc.api_call(
133
137
"reactions.remove",
@@ -144,7 +148,8 @@ Getting a list of channels
144
148
At some point, you'll want to find out what channels are available to your app. This is how you get that list.
145
149
146
150
**Note:** This call requires the ``channels:read`` scope.
147
-
..code-block::
151
+
152
+
.. code-block:: python
148
153
149
154
from slackclient import SlackClient
150
155
@@ -155,7 +160,7 @@ At some point, you'll want to find out what channels are available to your app.
155
160
156
161
Archived channels are included by default. You can exclude them by passing ``exclude_archived=1`` to your request.
157
162
158
-
::
163
+
.. code-block:: python
159
164
160
165
from slackclient import SlackClient
161
166
@@ -172,7 +177,8 @@ See `channels.list <https://api.slack.com/methods/channels.list>`_ for more info
172
177
Getting a channel's info
173
178
*************************
174
179
Once you have the ID for a specific channel, you can fetch information about that channel.
175
-
..code-block::
180
+
181
+
.. code-block:: python
176
182
177
183
from slackclient import SlackClient
178
184
@@ -188,7 +194,9 @@ See `channels.info <https://api.slack.com/methods/channels.info>`_ for more info
188
194
189
195
Joining a channel
190
196
********************
191
-
..code-block::
197
+
Channels are the social hub of most Slack teams. Here's how you hop into one:
198
+
199
+
.. code-block:: python
192
200
193
201
from slackclient import SlackClient
194
202
@@ -201,15 +209,16 @@ Joining a channel
201
209
)
202
210
203
211
If you are already in the channel, the response is slightly different.
204
-
``already_in_channel`` will be true, and a limited ``channel`` object will be returned.
212
+
``already_in_channel`` will be true, and a limited ``channel`` object will be returned. Bot users cannot join a channel on their own, they need to be invited by another user.
205
213
206
214
See `channels.join <https://api.slack.com/methods/channels.join>`_ for more info.
207
215
208
216
Leaving a channel
209
217
********************
210
218
Maybe you've finished up all the business you had in a channel, or maybe you
211
219
joined one by accident. This is how you leave a channel.
212
-
..code-block::
220
+
221
+
.. code-block:: python
213
222
214
223
from slackclient import SlackClient
215
224
@@ -225,4 +234,4 @@ See `channels.leave <https://api.slack.com/methods/channels.leave>`_ for more in
Copy file name to clipboardExpand all lines: docs-src/auth.rst
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,17 +8,20 @@ Handling tokens and other sensitive data
8
8
Slack tokens are the keys to your—or your customers’—teams. Keep them secret. Keep them safe. One way to do that is to never explicitly hardcode them.
9
9
10
10
Try to avoid this when possible:
11
-
::
11
+
12
+
.. code-block:: python
12
13
13
14
token ='xoxb-abc-1232'
14
15
15
16
If you commit this code to GitHub, the world gains access to this token’s team. Rather, we recommend you pass tokens in as environment variables, or persist them in a database that is accessed at runtime. You can add a token to the environment by starting your app as:
16
-
::
17
+
18
+
.. code-block:: python
17
19
18
20
SLACK_BOT_TOKEN="xoxb-abc-1232" python myapp.py
19
21
20
22
Then in your code retrieve the key with:
21
-
::
23
+
24
+
.. code-block:: python
22
25
23
26
import os
24
27
SLACK_BOT_TOKEN= os.environ["SLACK_BOT_TOKEN"]
@@ -48,7 +51,8 @@ In order to implement OAuth in your app, you will need to include a web server.
48
51
As mentioned above, we're setting the app tokens and other configs in environment variables and pulling them into global variables.
49
52
50
53
Depending on what actions your app will need to perform, you'll need different OAuth permission scopes. Review the available scopes `here <https://api.slack.com/docs/oauth-scopes>`_.
51
-
::
54
+
55
+
.. code-block:: python
52
56
53
57
import os
54
58
from flask import Flask, request
@@ -67,7 +71,8 @@ This directs the user to Slack's OAuth acceptance page, where the user will revi
67
71
or refuse the permissions your app is requesting as defined by the requested scope(s).
68
72
69
73
For the best user experience, use the `Add to Slack button <https://api.slack.com/docs/slack-button>`_ to direct users to approve your application for access or `Sign in with Slack <https://api.slack.com/docs/sign-in-with-slack>`_ to log users in.
70
-
::
74
+
75
+
.. code-block:: python
71
76
72
77
@app.route("/begin_auth", methods=["GET"])
73
78
defpre_install():
@@ -89,7 +94,7 @@ which do not require a token. ``oauth.access`` is one example of this. Since thi
89
94
is the endpoint you'll use to retrieve the tokens for later API requests,
90
95
an empty string ``""`` is acceptable for this request.
Copy file name to clipboardExpand all lines: docs-src/basic_usage.rst
+24-12Lines changed: 24 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,8 @@ The primary use of Slack is sending messages. Whether you're sending a message
20
20
to a user or to a channel, this method handles both.
21
21
22
22
To send a message to a channel, use the channel's ID. For IMs, use the user's ID.
23
-
::
23
+
24
+
.. code-block:: python
24
25
25
26
from slackclient import SlackClient
26
27
@@ -44,7 +45,8 @@ Updating the content of a message
44
45
Let's say you have a bot which posts the status of a request. When that request
45
46
is updated, you'll want to update the message to reflect it's state. Or your user
46
47
might want to fix a typo or change some wording. This is how you'll make those changes.
47
-
::
48
+
49
+
.. code-block:: python
48
50
49
51
from slackclient import SlackClient
50
52
@@ -66,7 +68,8 @@ and some special considerations when calling this with a bot user.
66
68
Deleting a message
67
69
-------------------
68
70
Sometimes you need to delete things.
69
-
::
71
+
72
+
.. code-block:: python
70
73
71
74
from slackclient import SlackClient
72
75
@@ -89,7 +92,8 @@ You can quickly respond to any message on Slack with an emoji reaction. Reaction
89
92
can be used for any purpose: voting, checking off to-do items, showing excitement — and just for fun.
90
93
91
94
This method adds a reaction (emoji) to an item (``file``, ``file comment``, ``channel message``, ``group message``, or ``direct message``). One of file, file_comment, or the combination of channel and timestamp must be specified.
92
-
::
95
+
96
+
.. code-block:: python
93
97
94
98
from slackclient import SlackClient
95
99
@@ -104,7 +108,8 @@ This method adds a reaction (emoji) to an item (``file``, ``file comment``, ``ch
104
108
)
105
109
106
110
Removing an emoji reaction is basically the same format, but you'll use ``reactions.remove`` instead of ``reactions.add``
107
-
::
111
+
112
+
.. code-block:: python
108
113
109
114
sc.api_call(
110
115
"reactions.remove",
@@ -123,7 +128,8 @@ Getting a list of channels
123
128
At some point, you'll want to find out what channels are available to your app. This is how you get that list.
124
129
125
130
**Note:** This call requires the ``channels:read`` scope.
126
-
::
131
+
132
+
.. code-block:: python
127
133
128
134
from slackclient import SlackClient
129
135
@@ -134,7 +140,8 @@ At some point, you'll want to find out what channels are available to your app.
134
140
135
141
Archived channels are included by default. You can exclude them by passing ``exclude_archived=1`` to your request.
136
142
137
-
::
143
+
144
+
.. code-block:: python
138
145
139
146
from slackclient import SlackClient
140
147
@@ -153,7 +160,8 @@ See `channels.list <https://api.slack.com/methods/channels.list>`_ for more info
153
160
Getting a channel's info
154
161
-------------------------
155
162
Once you have the ID for a specific channel, you can fetch information about that channel.
156
-
::
163
+
164
+
.. code-block:: python
157
165
158
166
from slackclient import SlackClient
159
167
@@ -171,7 +179,9 @@ See `channels.info <https://api.slack.com/methods/channels.info>`_ for more info
171
179
172
180
Joining a channel
173
181
------------------
174
-
::
182
+
Channels are the social hub of most Slack teams. Here's how you hop into one:
183
+
184
+
.. code-block:: python
175
185
176
186
from slackclient import SlackClient
177
187
@@ -184,7 +194,7 @@ Joining a channel
184
194
)
185
195
186
196
If you are already in the channel, the response is slightly different.
187
-
``already_in_channel`` will be true, and a limited ``channel`` object will be returned.
197
+
``already_in_channel`` will be true, and a limited ``channel`` object will be returned. Bot users cannot join a channel on their own, they need to be invited by another user.
188
198
189
199
See `channels.join <https://api.slack.com/methods/channels.join>`_ for more info.
190
200
@@ -194,7 +204,8 @@ Leaving a channel
194
204
------------------
195
205
Maybe you've finished up all the business you had in a channel, or maybe you
196
206
joined one by accident. This is how you leave a channel.
197
-
::
207
+
208
+
.. code-block:: python
198
209
199
210
from slackclient import SlackClient
200
211
@@ -212,7 +223,8 @@ See `channels.leave <https://api.slack.com/methods/channels.leave>`_ for more in
Copy file name to clipboardExpand all lines: docs/basic_usage.html
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@
116
116
<spanid="web-api-examples"></span><h1>Basic Usage<aclass="headerlink" href="#basic-usage" title="Permalink to this headline">¶</a></h1>
117
117
<p>The Slack Web API allows you to build applications that interact with Slack in more complex ways than the integrations
118
118
we provide out of the box.</p>
119
-
<p>This package is a modular wrapper designed to make Slack <aclass="reference external" href="https://api.slack.com/web">Web API</a> calls simpler and easier for your
119
+
<p>This package is a modular wrapper designed to make Slack <ahref="#id1"><spanclass="problematic" id="id2">`Web API`_</span></a> calls simpler and easier for your
120
120
app. Provided below are examples of how to interact with commonly used API endpoints, but this is by no means
121
121
a complete list. Review the full list of available methods <aclass="reference external" href="https://api.slack.com/methods">here</a>.</p>
122
122
<p>See <aclass="reference internal" href="auth.html#handling-tokens"><spanclass="std std-ref">Tokens & Authentication</span></a> for API token handling best practices.</p>
@@ -259,19 +259,20 @@ <h2>Getting a channel’s info<a class="headerlink" href="#getting-a-channel
259
259
<hrclass="docutils" />
260
260
<divclass="section" id="joining-a-channel">
261
261
<h2>Joining a channel<aclass="headerlink" href="#joining-a-channel" title="Permalink to this headline">¶</a></h2>
262
+
<p>Channels are the social hub of most Slack teams. Here’s how you hop into one:</p>
<p>If you are already in the channel, the response is slightly different.
274
-
<codeclass="docutils literal"><spanclass="pre">already_in_channel</span></code> will be true, and a limited <codeclass="docutils literal"><spanclass="pre">channel</span></code> object will be returned.</p>
275
+
<codeclass="docutils literal"><spanclass="pre">already_in_channel</span></code> will be true, and a limited <codeclass="docutils literal"><spanclass="pre">channel</span></code> object will be returned. Bot users cannot join a channel on their own, they need to be invited by another user.</p>
275
276
<p>See <aclass="reference external" href="https://api.slack.com/methods/channels.join">channels.join</a> for more info.</p>
Copy file name to clipboardExpand all lines: docs/faq.html
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -154,11 +154,11 @@ <h2>How do I compile the documentation?<a class="headerlink" href="#how-do-i-com
154
154
<p>This project’s documentation is generated with <aclass="reference external" href="http://www.sphinx-doc.org">Sphinx</a>. If you are editing one of the many
155
155
reStructuredText files in the <codeclass="docutils literal"><spanclass="pre">docs-src</span></code> folder, you’ll need to rebuild the documentation. First, install the project’s
156
156
development dependencies (ideally using <aclass="reference external" href="https://virtualenv.pypa.io">virtualenv</a>.</p>
0 commit comments