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
Copy file name to clipboardExpand all lines: docs/source/access_token.rst
+149Lines changed: 149 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -161,3 +161,152 @@ AccessToken
161
161
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
162
162
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
163
163
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
164
+
165
+
.. class:: PartialAccessToken()
166
+
167
+
.. attribute:: client
168
+
169
+
The client which generated this AccessToken
170
+
171
+
:type::class:`discordoauth2.Client`
172
+
173
+
.. atribute:: token
174
+
175
+
The raw token for this AccessToken, you can use :class:`discordoauth2.Client.from_access_token` to use it again.
176
+
177
+
:type: str
178
+
179
+
.. atribute:: expires
180
+
181
+
The number of seconds until it expires from when the instance was created.
182
+
183
+
:type: int
184
+
185
+
.. atribute:: scope
186
+
187
+
A list of scopes that are provided.
188
+
189
+
:type: list[str]
190
+
191
+
.. atribute:: refresh_token
192
+
193
+
The refresh_token for this AccessToken, you can use :class:`discordoauth2.Client.refresh_token` to use this authorization again after it expires.
194
+
195
+
:type: str
196
+
197
+
.. atribute:: webhook
198
+
199
+
A `parital webhook object <https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure>`__ if they was a ``webhook.incoming`` scope.
200
+
201
+
:type: dict
202
+
203
+
.. atribute:: guild
204
+
205
+
A `partial guild object <https://discord.com/developers/docs/resources/guild#guild-object-guild-structure>`__ if a bot was added to a guild.
206
+
207
+
:type: dict
208
+
209
+
.. method:: fetch_identify()
210
+
211
+
Returns a dictionary with a `user object <https://discord.com/developers/docs/resources/user#user-object-user-structure>`__ which includes ``email`` and ``verified`` (verified email) if the ``email`` scope is provided
212
+
213
+
:returns::class:`dict`
214
+
:raises discordoauth2.exceptions.HTTPException: The request failed
215
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the identify scope.
216
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
217
+
218
+
.. method:: fetch_connections()
219
+
220
+
Returns a list of `connection objects <https://discord.com/developers/docs/resources/user#connection-object-connection-structure>`__
221
+
222
+
:returns::class:`list`
223
+
:raises discordoauth2.exceptions.HTTPException: The request failed
224
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the connections scope.
225
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
226
+
227
+
228
+
.. method:: fetch_guilds()
229
+
230
+
Returns a list of partial `guild objects <https://discord.com/developers/docs/resources/guild#guild-object>`__
231
+
232
+
:returns::class:`list`
233
+
:raises discordoauth2.exceptions.HTTPException: The request failed
234
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds scope.
235
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
236
+
237
+
.. method:: fetch_guild_member(guild_id)
238
+
239
+
Returns a partial `guild member object <https://discord.com/developers/docs/resources/guild#guild-member-object-guild-member-structure>`__
240
+
241
+
:param int guild_id: The guild ID to retrieve member data from.
242
+
243
+
:returns::class:`dict`
244
+
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
245
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
246
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
Adds the user to a guild. The application's bot must also be in the guild, have invite permissions and it's bot token must also be provided.
251
+
252
+
:param int guild_id: The guild ID to retrieve member data from.
253
+
:param str nick: The nickname the member should have when they join.
254
+
:param list[int] role_ids: a List of role IDs to assign them when they join.
255
+
:param bool mute: Wether they should be server muted when they join.
256
+
:param bool deaf: Wether they should be server deafend when they join.
257
+
258
+
:returns::class:`dict`
259
+
:raises discordoauth2.exceptions.HTTPException: The request failed
260
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.join scope or the bot isn't in the guild/have the correct permissions.
261
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
262
+
263
+
.. method:: fetch_metadata()
264
+
265
+
Returns the user's `metadata object <https://discord.com/developers/docs/resources/user#application-role-connection-object>`__ for this application.
266
+
267
+
.. versionadded:: 1.1
268
+
269
+
:returns::class:`dict`
270
+
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
271
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
272
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
Updates and returns the user's `metadata object <https://discord.com/developers/docs/resources/user#application-role-connection-object>`__ for this application.
277
+
278
+
.. versionadded:: 1.1
279
+
280
+
:param str platform_name: Text that appears at the top of the app connection box, usally denoting the platform's name.
281
+
:param str platform_username: Text that appears under the platform name, large, and usally denoting the user's name on the platform.
282
+
:param dict metadata: List of keys and values to set the user's metadata. Supported types: :class:`bool`, :class:`datetime.datetime`, :class:`int`
283
+
284
+
:returns::class:`dict`
285
+
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
286
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
287
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
288
+
289
+
.. warning::
290
+
291
+
You must make sure to store the access token and refresh token, otherwise you won't be able to update or remove the metadata later.
292
+
293
+
.. method:: clear_metadata()
294
+
295
+
Removes the user's `metadata object <https://discord.com/developers/docs/resources/user#application-role-connection-object>`__ for this application.
296
+
297
+
.. versionadded:: 1.1
298
+
299
+
:returns::class:`dict`
300
+
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
301
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
302
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
303
+
304
+
.. method:: revoke()
305
+
306
+
Shorthand for :meth:`Client.revoke_token`, it will revoke the access token and any related refresh token.
307
+
308
+
.. versionadded:: 1.1
309
+
310
+
:raises discordoauth2.exceptions.HTTPException: The request failed, possibly because the member is not in the guild.
311
+
:raises discordoauth2.exceptions.Forbidden: The AccessToken doesn't have the guilds.member.read scope.
312
+
:raises discordoauth2.exceptions.RateLimited: You're being rate limited.
Copy file name to clipboardExpand all lines: docs/source/client.rst
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,4 +74,12 @@ Client
74
74
75
75
.. warning::
76
76
77
-
If the application is owned by a team, you can only request for the `identify` scope. You can also request `applications.commands.update`, but the library does not support it yet.
77
+
If the application is owned by a team, you can only request for the `identify` scope. You can also request `applications.commands.update`, but the library does not support it yet.
Updates the application's linked roles metadata, requires bot token to have been provided.
82
+
83
+
.. versionadded:: 1.1
84
+
85
+
:param dict metadata: Should be a list of `application role connection metadata<https://discord.com/developers/docs/resources/application-role-connection-metadata#application-role-connection-metadata-object>__`
0 commit comments