Skip to content
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
f466779
fix: fix docs building warnings & errors
mAxYoLo01 Oct 4, 2022
dd3440e
feat: change overall docs layout and remove pages that do not need to…
mAxYoLo01 Oct 4, 2022
745b587
fix: rectify indenting
mAxYoLo01 Oct 4, 2022
fc2713b
feat: remove private methods from docs
mAxYoLo01 Oct 5, 2022
0814313
update bot.py
mAxYoLo01 Oct 5, 2022
a4b753e
update context.py and hide inherited members from ClientSerializerMixin
mAxYoLo01 Oct 5, 2022
a2e87b6
update client.models
mAxYoLo01 Oct 5, 2022
f7d2b4b
update utils.py
mAxYoLo01 Oct 5, 2022
d554c81
update audit_log.py
mAxYoLo01 Oct 5, 2022
1f8d7c2
update channel.py
mAxYoLo01 Oct 5, 2022
3d50874
update emoji.py
mAxYoLo01 Oct 5, 2022
d69c1f2
update guild.py
mAxYoLo01 Oct 5, 2022
a23dbfe
update gw.py and move location of Permission class
mAxYoLo01 Oct 6, 2022
fc4e518
update member.py
mAxYoLo01 Oct 6, 2022
6c00ace
update message.py
mAxYoLo01 Oct 6, 2022
fc7249c
update message.py
mAxYoLo01 Oct 6, 2022
5007152
update misc.py
mAxYoLo01 Oct 6, 2022
2aaf64d
update presence.py
mAxYoLo01 Oct 6, 2022
f3038c3
update role.py
mAxYoLo01 Oct 6, 2022
6b0ba4e
update team.py
mAxYoLo01 Oct 6, 2022
b3dac66
update user.py
mAxYoLo01 Oct 6, 2022
6a03207
update webhook.py
mAxYoLo01 Oct 6, 2022
10d15be
update cache, dispatch & error
mAxYoLo01 Oct 6, 2022
4803418
update api.gateway
mAxYoLo01 Oct 6, 2022
22acb3c
fix: missing few places
mAxYoLo01 Oct 6, 2022
9a9e83a
ci: correct from checks.
pre-commit-ci[bot] Oct 6, 2022
6d15d88
update
mAxYoLo01 Oct 6, 2022
ca61cd7
Merge branch 'docstring-update' of https://github.com/mAxYoLo01/libra…
mAxYoLo01 Oct 6, 2022
b3e3b56
Merge branch 'unstable' into docstring-update
mAxYoLo01 Oct 9, 2022
95f2a37
fix args type
mAxYoLo01 Oct 9, 2022
950448b
Merge branch 'unstable' into docstring-update
mAxYoLo01 Oct 14, 2022
25baf66
feat: remove http files from docs
mAxYoLo01 Oct 31, 2022
f673679
Merge branch 'unstable' into docstring-update
mAxYoLo01 Oct 31, 2022
ecbf91a
fix: add back HTTP page but hide it from search index
mAxYoLo01 Oct 31, 2022
c575085
fix: actually remove HTTP methods from search index
mAxYoLo01 Nov 1, 2022
37f2a36
feat: merge all request classes docs under HTTPClient docs
mAxYoLo01 Nov 1, 2022
7988689
Merge branch 'unstable' into docstring-update
mAxYoLo01 Nov 2, 2022
db1e457
Merge branch 'unstable' into docstring-update
mAxYoLo01 Nov 4, 2022
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
7 changes: 0 additions & 7 deletions docs/api.cache.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api.dispatch.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api.enums.rst

This file was deleted.

7 changes: 0 additions & 7 deletions docs/api.error.rst

This file was deleted.

13 changes: 0 additions & 13 deletions docs/api.gateway.rst

This file was deleted.

4 changes: 4 additions & 0 deletions docs/api.http.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
HTTP
====

.. important::
This page shows internal functions that you should not use unless you know how to use them.
Most of these functions should have their own implementation in the different Models of the library.

.. autoclass:: interactions.api.http.route.Route
:members:

Expand Down
3 changes: 2 additions & 1 deletion docs/api.models.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. currentmodule:: interactions

Model Objects
API Models
=============

.. toctree::
Expand All @@ -20,3 +20,4 @@ Model Objects
api.models.team.rst
api.models.user.rst
api.models.webhook.rst
enums.rst
41 changes: 17 additions & 24 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
API Reference
=============

This page outlines the API wrapper of discord-interactions.

Interactions
************
This page outlines the API reference of interactions.py.

.. toctree::
:maxdepth: 2
Expand All @@ -16,40 +13,36 @@ Interactions

.. toctree::
:maxdepth: 2
:caption: Frameworks/Commands
:caption: API Models

ext.rst
context.rst
utils.rst
api.models.rst

.. toctree::
:maxdepth: 2
:caption: Model/Design
:caption: Commands & Components

models.rst
enums.rst

Discord API
***********

.. toctree::
:maxdepth: 2
:caption: Client Connections
:caption: Context

api.gateway.rst
api.http.rst
context.rst

.. toctree::
:maxdepth: 2
:caption: Model/Design
:caption: Utilities

api.cache.rst
api.enums.rst
api.models.rst
utils.rst

.. toctree::
:maxdepth: 2
:caption: Events
:maxdepth: 1
:caption: HTTP

api.http.rst

.. toctree::
:maxdepth: 1
:caption: External Framework

api.dispatch.rst
api.error.rst
ext.rst
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
exclude_patterns = ["_build"]

# This autodocs private attrs and also fixes wrong sort
autodoc_default_options = {"member-order": "bysource", "private-members": True}
autodoc_default_options = {"member-order": "bysource"}


# -- Options for HTML output -------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion docs/context.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ Event Context
=============

.. automodule:: interactions.client.context
:inherited-members: ClientSerializerMixin
:members:
:inherited-members:
:private-members:
26 changes: 10 additions & 16 deletions docs/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ Generally, you can listen to an event like this:

# possibility 1
@bot.event
async def on_(...):
async def on_xxx(...):
... # do smth

# possibility 2
@bot.event(name="on_")
@bot.event(name="on_xxx")
async def you_are_free_to_name_this_as_you_want(...):
... # do smth

bot.start()


```` represents the Discord event name - but lowercase and any spaces replaced with ``_``.
``xxx`` represents the Discord event name - but with lowercase characters and any spaces replaced with ``_``.

For example:

Expand Down Expand Up @@ -74,7 +74,7 @@ as long as you don't absolutely need it.


Event: ``on_start``
^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This event fires only when the bot is started.

This function takes no arguments.
Expand All @@ -83,7 +83,7 @@ This function takes no arguments.
Unlike ``on_ready``, this event will never be dispatched more than once.

Event: ``on_interaction``
^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This event fires on any interaction (commands, components, autocomplete and modals).

The function needs one argument. It will have the type ``CommandContext`` or ``ComponentContext``.
Expand All @@ -93,7 +93,7 @@ recommend using this event unless you have experience with it.


Event: ``on_command``
^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This event fires on any Application Command (slash command + context menu command) used.

The function takes in one argument of the type ``CommandContext``.
Expand All @@ -113,7 +113,7 @@ The function takes in two arguments, one of the type ``CommandContext``, and the


Event: ``on_component``
^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^
This event fires on any Component used (for now, those are Buttons and Select Menus).

The function takes in one argument of the type ``ComponentContext``.
Expand Down Expand Up @@ -141,27 +141,24 @@ The function takes in one argument of the type ``CommandContext``.
You will have to get all values yourself and check what modal was used when using this event.


Additionally, if you struggle with getting the values, you can check
:ref:`how it is handled internally `.


After this, let us look at events from the Discord API.

Discord API Events
******************

Events in this section do not match the name needed to put into the function. Please check
:ref:`above ` for how to get the correct name.
:ref:`above<events:How to listen for events>` for how to get the correct name.


There are a lot of events dispatched by the Discord API. All of those can be found `here`_.
There are a lot of events dispatched by the Discord API. All of those can be found `here <https://discord.com/developers/docs/topics/gateway-events#receive-events>`_.

The events ``HELLO``, ``RESUMED``, ``RECONNECT``, ``INVALID SESSION`` and ``TYPING START`` are not dispatched by the library.

``TYPING START`` will be included in the raw socket create event. You can
also listen for it if you choose to subclass the WebSocketClient

The event ``VOICE STATE UPDATE`` can be only received with the voice :ref:`Extension `.
The event ``VOICE STATE UPDATE`` can be only received with the :ref:`voice extension<faq:Extension libraries>`.


Let's now have a look at a few events:
Expand Down Expand Up @@ -197,6 +194,3 @@ The function takes in one argument of the type ``GuildMember``.

The argument has the same methods as a normal ``Member`` object, except the methods *do not take in a guild id*.
Please keep that in mind when using this event.


.. _here: https://Discord.com/developers/docs/topics/gateway#commands-and-events-gateway-events
6 changes: 3 additions & 3 deletions docs/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ You can get those object via the ``get_channel()`` and ``get_guild()`` methods o


"``ctx.send got an unexpected keyword argument: files``"! Why?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is not supported due to an decision of the core developer team.
There are two ways to do it:

Expand All @@ -215,7 +215,7 @@ There are two ways to do it:


"``ctx.send got an unexpected keyword argument: embed``"! Why?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is quite simple: The argument ``embed`` got deprecated by Discord. The new naming is ``embeds``.


Expand Down Expand Up @@ -244,7 +244,7 @@ You can additionally get the exact reason for why the exception occurred with ``


My message content is always empty! How can I fix this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This happens because you did not enable the intent for message content. Enable it on the developer portal and
add it into the ``Client`` definition as the following:
``bot = interactions.Client(..., intents=interactions.Intents.DEFAULT | interactions.Intents.GUILD_MESSAGE_CONTENT)``
Expand Down
4 changes: 2 additions & 2 deletions docs/models.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. currentmodule:: interactions

Interaction Models
==================
Commands & Components
=====================

.. toctree::
:maxdepth: 2
Expand Down
8 changes: 4 additions & 4 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Quickstart
Installing
**********

**discord-interactions** is a :ref:`Python library <index:interactions.py>` for the Discord Application Programming Interface. (API)
**interactions.py** is a :ref:`Python library <index:interactions.py>` for the Discord Application Programming Interface. (API)
A library in Python has to be installed through the `pip` file. Run this in your terminal/command line
in order to install our library:

Expand Down Expand Up @@ -99,7 +99,7 @@ Let's take a look now at what is happening here:


Now, let's create our first slash command:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. code-block:: python

Expand Down Expand Up @@ -561,7 +561,7 @@ Responding to a Modal interaction
You can respond to a modal the same way as you would respond to a normal ``chat-input`` command, except your function has an extra argument for the text what was put into the modal.

Adding v2 Permissions
^^^^^^^^^^^^^^^^^^^^^
*********************

v2 permissions consist of the ``default_member_permissions`` and ``dm_permission`` keyword arguments.
Similar to adding privileged intents, you add permissions (like admin-only, ``BAN_MEMBERS``-only, etc.) as follows:
Expand Down Expand Up @@ -625,7 +625,7 @@ Likewise, setting ``dm_permission`` to ``True`` makes it usable in DMs. Just to
global commands. Guild commands with this argument will have no effect.

Utilities
^^^^^^^^^
*********

You can use the following utilities to help you with your commands:

Expand Down
7 changes: 7 additions & 0 deletions docs/utils.get.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. currentmodule:: interactions

The ``get`` utility method
==========================

.. automodule:: interactions.utils.get
:members:
15 changes: 6 additions & 9 deletions docs/utils.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
.. currentmodule:: interactions

The ``get`` utility method
================

.. automodule:: interactions.utils.get
:members:

Utilities
==========================
==========

.. toctree::
:maxdepth: 2

.. automodule:: interactions.utils.utils
:members:
utils.get.rst
utils.utils.rst
7 changes: 7 additions & 0 deletions docs/utils.utils.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. currentmodule:: interactions

Utility Functions
=================

.. automodule:: interactions.utils.utils
:members:
Loading