Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1877a69
Update README.md
Arcader717 Nov 19, 2023
8d42045
Update url.py
Arcader717 Nov 19, 2023
7e85325
Update README.md
Arcader717 Nov 19, 2023
5f10b8c
Update CHANGELOG.rst
Arcader717 Nov 19, 2023
fee40c7
Update README.md
Arcader717 Nov 19, 2023
8261468
Update url.py
Arcader717 Nov 19, 2023
84c6f40
Update README.md
Arcader717 Nov 20, 2023
2697e93
Update url.py
Arcader717 Nov 20, 2023
4366727
Update api_test.py
Arcader717 Nov 22, 2023
408eba2
Update api_test.py
Arcader717 Nov 27, 2023
bdb8c8a
Fix api_test.py
Arcader717 Nov 27, 2023
098773e
Fix url.py
Arcader717 Nov 27, 2023
0d61cb9
Fix url.py
Arcader717 Nov 27, 2023
d6664ed
Update url.py
Arcader717 Nov 27, 2023
6c7861c
Update url.py
Arcader717 Nov 27, 2023
ab67a0e
Update api_tests.py
Arcader717 Nov 27, 2023
e8bcc25
Fix api_test.py
Arcader717 Nov 27, 2023
e966eed
Fix api_test.py
Arcader717 Nov 28, 2023
71520b8
Update api_test.py
Arcader717 Nov 28, 2023
9628c38
Update version to "2.1.0-alpha"
Arcader717 Nov 29, 2023
9ec07f6
Update quickstart.rst
Arcader717 Nov 29, 2023
759403c
Update url.py and reference.rst
Arcader717 Nov 29, 2023
5237548
Update api.rst
Arcader717 Nov 29, 2023
40e4627
Update api.rst
Arcader717 Nov 29, 2023
12fb0d0
Fix permissions.rst
Arcader717 Nov 29, 2023
0f84882
Fix permissions.rst
Arcader717 Nov 29, 2023
fc95101
Update conf.py
Arcader717 Nov 29, 2023
4c9ca4e
Update exceptions.py
Arcader717 Nov 30, 2023
48e93c1
Update url.py
Arcader717 Nov 30, 2023
8e5f15d
Merge branch 'add/Arcader717-User-functions' into Update-main
Arcader717 Dec 2, 2023
b71c74a
Merge pull request #81 from disoauth/Update-main
Arcader717 Dec 2, 2023
efe5180
Update reference.rst
Arcader717 Dec 2, 2023
057101d
Update models.py
Arcader717 Dec 2, 2023
e578dd0
Update url.py
Arcader717 Dec 2, 2023
755d5c1
Update models.py
Arcader717 Dec 2, 2023
fc2ebbb
Fix permissions.rst
Arcader717 Dec 6, 2023
ff7f01c
Update CHANGELOG.rst
Arcader717 Dec 6, 2023
e5f9681
Fix migration.rst
Arcader717 Dec 6, 2023
b636536
Updated api.rst
Arcader717 Dec 6, 2023
1ff9905
Update index.rst
Arcader717 Jan 19, 2024
b1e0680
Add - A .gitignore (finally)
Arcader717 May 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.replit
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ It also makes bot auth url's
<details>
<summary>User Functions</summary>

- [ ] Get User - v2.1
- [ ] Modify Current User - v2.1
- [ ] Get Current Guild Members - v2.1
- [ ] Leave Guild - v2.1
- [ ] Create DM - v2.1
- [ ] Create Group DM - v2.1
- [ ] Get Current User Connections - v2.1
- [ ] Get Current User Application Role Connection - v2.1
- [ ] Update Current User Application Role Connection - v2.1
- [x] Get User - v2.1
- [x] Modify Current User - v2.1
- [ ] Get Current Guild Member - v2.3
- [x] Leave Guild - v2.1
- [x] Create DM - v2.1
- [x] Create Group DM - v2.1
- [x] Get Current User Connections - v2.1
- [x] Get Current User Application Role Connection - v2.1
- [x] Update Current User Application Role Connection - v2.1
- [ ] Guild
- [ ] Functions
<details>
Expand Down
20 changes: 20 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,25 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <https://keepachangelog.com/en/1.0.0/>`_,
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.

[`Unreleased`_]
===============

Added
-----

* Get User Function, using a user id, added to the :meth:`discord.user.fetch` method of the :class:`discord.user` class
* Modify Current User
* Get Current Guild Member
* Leave Guild
* Create DM
* Create Guild DM

Fixed
-----

* The documentation in the :doc:`permissions` page
* The documentation in the :doc:`migration` page

[`2.0.0`_] - November 13, 2023
==============================

Expand Down Expand Up @@ -244,6 +263,7 @@ Added
* The AuthUrl class, that would return the auth url
* Added a function to make the state for the auth url

.. _Unreleased: https://github.com/disoauth/DiscoAuth/compare/v2.0.0...add/Arcader717-User-functions
.. _Diff: https://github.com/disoauth/DiscoAuth/compare/v1.4.0...v2.0.0
.. _2.0.0: https://github.com/disoauth/DiscoAuth/compare/v2.0.0-rc.1...v2.0.0
.. _2.0.0-rc.1: https://github.com/disoauth/DiscoAuth/compare/v1.4.0...v2.0.0-rc.1
Expand Down
7 changes: 7 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
API
===

Welcome to the API!
If you are here to check out the general reference head over to :doc:`reference`.
If you want to check out the permissions reference, visit the :doc:`permissions` documentation.

.. toctree::
:maxdepth: 0
:hidden:

reference
permissions
cliAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
project = 'DiscoAuth'
copyright = '2023, Arcader717'
author = 'Arcader717'
version = '2.0'
release = '2.0.0'
version = '2.1'
release = '2.1.0'
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary'
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Welcome to DisOAuth's documentation!
===================================


**DisOAuth** (AKA Discord OAuth) is a python package to help create a oauth process for your Discord Application and/or your Discord Bot, using a *simple* api
**DiscoAuth** (AKA Discord OAuth) is a python package to help create a oauth process for your Discord Application and/or your Discord Bot, using a *simple* api

To setup DisOAuth, you'll need to go to the :doc:`quickstart` page to get started, and see how to :ref:`install <installation>` it

Expand Down
18 changes: 9 additions & 9 deletions docs/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ We can use
:language: python
:linenos:

from DisOAuth import auth, discord, bot, permissions
from discoauth import auth, discord, bot, permissions

I highly suggest using the :code:`ctrl + F` shortcut, to find the old names and replace it with the new names

The following list shows what classes and methods are replaced with what name

* :code:`AuthUrl` --> :code:`auth`
* :code:`discordApi` --> :code:`discord`
* :code:`makeUrl` --> :code:`url`
* :code:`accessToken` --> :code:`token`
* :code:`User` --> :code:`user`
* :code:`get_current_user` --> :code:`fetch`
* :code:`get_user_guilds` --> :code:`guilds`
* :code:`get_guild` --> :code:`fetch`
* :code:`AuthUrl` --> :class:`auth`
* :code:`discordApi` --> :class:`discord`
* :code:`makeUrl` --> :meth:`auth.url`
* :code:`accessToken` --> :meth:`discord.token`
* :code:`User` --> :class:`user`
* :code:`get_current_user` --> :meth:`discord.user.fetch`
* :code:`get_user_guilds` --> :meth:`discord.user.guilds`
* :code:`get_guild` --> :meth:`discord.guild.fetch`

Special Cases
=============
Expand Down
6 changes: 3 additions & 3 deletions docs/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The permissions is imported using the :class:`permissions` class
:linenos:
:caption: perms.py

from DisOAuth import permissions
from discoauth import permissions

Permissions
-----------
Expand All @@ -23,7 +23,7 @@ To set multiple permission with the names when the :class:`permissions` class is
:lineno-start: 3
:caption: Multiple perms, init, name

perms = permissions(["kick_members", "ban_members"]
perms = permissions(["kick_members", "ban_members"])

.. code-block:: python
:lineno-start: 3
Expand Down Expand Up @@ -54,7 +54,7 @@ To set multiple permission with the names when the :class:`permissions` class is
+-------------------------------------+--------+
| stream | 9 |
+-------------------------------------+--------+
| view_channe; | 10 |
| view_channel | 10 |
+-------------------------------------+--------+
| send_messages | 11 |
+-------------------------------------+--------+
Expand Down
5 changes: 2 additions & 3 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ Now, we need a new variable, ``client_secret``. Which is your app's client secre
using the other three variables and ``client_secret`` we can use :class:`discord`. ::

api = discord(client_id, client_secret, scope, redirect_uri)
r = await api.token(code)
token = r['access_token']
token = await api.token(code)

Now, ``token`` is your access token. Save this somewhere safe.
Now, ``token`` is the response, which can contain a new token. Save this somewhere safe.

Remember, :func:`token` returns a dictionary, containing the entire response, so you can still get the ``refresh_token``

Expand Down
59 changes: 59 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,65 @@ API Reference
.. versionchanged:: 2.0
Renamed to :meth:`discord.user.guilds` from the previous :meth:`discordApi.User.get_user_guilds`

.. py:method:: modify(username)
:async:

Changes the username or avatar url of the user

:param username: The username of the user that you would like to modify, this is NOT the user's display name. Defaults to none, and uses the access token as the user
:type username: str | None
:return: The json returned by Discord API

.. versionadded:: 2.1

.. py:method:: leaveGuild(guild)
:async:

Makes a user leave a guild

:param guild: The id of the guild
:type guild: str | int
:return: Whether the user had left. Returns true if successful, and false if not
:rtype: bool

.. versionadded:: 2.1

.. py:method:: dm(id, tokens, nicks)
:async:

DM a user or group of users

:param id: The id of the user you want to DM. This does not apply to group DM's
:param tokens: The access tokens of the users you would like to DM. This does not apply to DMing a single user
:param nicks: The nicks of the users. This does not apply to DMing a single user
:type id: str | None = None
:type tokens: List[str] | None = None
:type nicks: Dict[str, str] | None = None
:return: The json response returned by Discord API

.. versionadded:: 2.1

.. py:method:: connections(id)
:async:

Can get a user's regular and application connections. Must use the ``connections`` scope for regular connections, and ``role_connections.write`` for application connections

:param id: The id of the application connected to a user
:type: str | None = None
:return: The json response returned by Discord API

.. versionadded:: 2.1

.. py:method:: modifyConnections(id)
:async:

Modifies a user's application connections

:param id: The id of the application
:return: The json response returned by Discord API

.. versionadded:: 2.1

.. py:class:: guild(token)

Provides access to the guild links in the Discord API
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "discoauth"
version = "2.1.0"
version = "2.1.0-alpha"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
version = "2.1.0-alpha"
version = "2.1.0"


description = "Discord OAuth, and Discord API, in one package"
readme = "README.md"
Expand Down
10 changes: 10 additions & 0 deletions src/discoauth/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,13 @@ def __init__(self,
super().__init__("The permission number you passed is invalid")
elif permissionInt is not None:
super().__init__(f"The permission number you passed, {permissionInt}, is invalid")

class DiscordException(Exception):
"""Raised when something unusual happens with the Discord API. Raise with the error message

Attributes:
message -- The error message returned by discord api
"""
def __init__(self, message: str):
super().__init__(f"The following error was raised by Discord API\n\n{message}")

Loading