Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Jun 5, 2023
1 parent f18ff20 commit 46cb101
Show file tree
Hide file tree
Showing 5 changed files with 199 additions and 16 deletions.
20 changes: 19 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
"sphinxcontrib.asyncio",
"sphinx.ext.intersphinx",
"attributetable",
"sphinxext.opengraph"
]

# OpenGraph Meta Tags
ogp_image = "https://raw.githubusercontent.com/PythonistaGuild/Wavelink/master/logo.png"
ogp_description = "Documentation for Wavelink, the Powerful Lavalink wrapper for discord.py."
ogp_site_url = "https://wavelink.dev/"
ogp_custom_meta_tags = [
'<meta property="og:description" content="A robust and powerful Lavalink wrapper for Discord.py. Wavelink features a fully asynchronous API that\'s intuitive and easy to use with built in Spotify Support and Node Pool Balancing." />',
'<meta property="og:title" content="Wavelink Documentation" />'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -101,7 +111,15 @@
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

intersphinx_mapping = {"py": ("https://docs.python.org/3", None)}
intersphinx_mapping = {
"py": ("https://docs.python.org/3", None),
"dpy": ("https://discordpy.readthedocs.io/en/stable/", None)
}

extlinks = {
'wlissue': ('https://github.com/PythonistaGuild/Wavelink/issues/%s', 'GH-%s'),
'ddocs': ('https://discord.com/developers/docs/%s', None),
}

pygments_style = "sphinx"
pygments_dark_style = "monokai"
99 changes: 99 additions & 0 deletions docs/ext/spotify.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
.. currentmodule:: wavelink.ext.spotify


Intro
-----
The Spotify extension is a QoL extension that helps in searching for and queueing tracks from Spotify URL's or ID's. To get started create a :class:`~SpotifyClient` and pass in your credentials. You then pass this to your :class:`wavelink.Node`'s.

An example:

.. code-block:: python3
import discord
import wavelink
from discord.ext import commands
from wavelink.ext import spotify
class Bot(commands.Bot):
def __init__(self) -> None:
intents = discord.Intents.default()
intents.message_content = True
super().__init__(intents=intents, command_prefix='?')
async def on_ready(self) -> None:
print(f'Logged in {self.user} | {self.user.id}')
async def setup_hook(self) -> None:
sc = spotify.SpotifyClient(
client_id='CLIENT_ID',
client_secret='CLIENT_SECRET'
)
node: wavelink.Node = wavelink.Node(uri='http://127.0.0.1:2333', password='youshallnotpass')
await wavelink.NodePool.connect(client=self, nodes=[node], spotify=sc)
bot = Bot()
@bot.command()
@commands.is_owner()
async def play(ctx: commands.Context, *, search: str) -> None:
try:
vc: wavelink.Player = await ctx.author.voice.channel.connect(cls=wavelink.Player)
except discord.ClientException:
vc: wavelink.Player = ctx.voice_client
vc.autoplay = True
track: spotify.SpotifyTrack = await spotify.SpotifyTrack.search(search)
if not vc.is_playing():
await vc.play(track, populate=True)
else:
await vc.queue.put_wait(track)
Helpers
-------
.. autofunction:: decode_url


Client
------
.. attributetable:: SpotifyClient

.. autoclass:: SpotifyClient
:members:


Enums
-----
.. attributetable:: SpotifySearchType

.. autoclass:: SpotifySearchType
:members:


Spotify Tracks
--------------
.. attributetable:: SpotifyTrack

.. autoclass:: SpotifyTrack
:members:


Exceptions
----------
.. py:exception:: SpotifyRequestError
Base error for Spotify requests.

status: :class:`int`
The status code returned from the request.
reason: Optional[:class:`str`]
The reason the request failed. Could be ``None``.
14 changes: 10 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,14 @@
<div class="index-apis-section">
<b>Wavelink Reference:</b>
<ul class="index-featuring-list">
<li><a href="wavelink.html" class="reference internal">API Reference</a>
<li><a href="wavelink.html" class="reference internal">API Reference</a></li>
</ul>
</div>

<div class="index-apis-section">
<b>Wavelink Extension API's:</b>
<ul class="index-featuring-list">
<li>Spotify Support coming soon...
<li>YouTube AutoPlay coming soon...

<li><a href="ext/spotify.html" class="reference internal">Spotify Extension</a></li>
</ul>
</div>
</div>
Expand All @@ -75,6 +73,14 @@
recipes


.. rst-class:: index-display-none
.. toctree::
:maxdepth: 1
:caption: Spotify Extension

ext/spotify


.. rst-class:: index-display-none
.. toctree::
:maxdepth: 1
Expand Down
3 changes: 2 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ sphinxcontrib-asyncio
sphinxcontrib-websupport
Pygments
furo
discord.py>=1.7.3
discord.py>=2.0.1
sphinxext-opengraph
79 changes: 69 additions & 10 deletions docs/wavelink.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,34 @@ Payloads
:members:


Enums
-----
.. attributetable:: NodeStatus

.. autoclass:: NodeStatus
:members:

.. attributetable:: TrackSource

.. autoclass:: TrackSource
:members:

.. attributetable:: LoadType

.. autoclass:: LoadType
:members:

.. attributetable:: TrackEventType

.. autoclass:: TrackEventType
:members:

.. attributetable:: DiscordVoiceCloseType

.. autoclass:: DiscordVoiceCloseType
:members:


Abstract Base Classes
---------------------
.. attributetable:: wavelink.tracks.Playable
Expand Down Expand Up @@ -159,52 +187,52 @@ Queues
Filters
-------

.. attributeable:: Filter
.. attributetable:: Filter

.. autoclass:: Filter
:members:

.. attributeable:: Equalizer
.. attributetable:: Equalizer

.. autoclass:: Equalizer
:members:

.. attributeable:: Karaoke
.. attributetable:: Karaoke

.. autoclass:: Karaoke
:members:

.. attributeable:: Timescale
.. attributetable:: Timescale

.. autoclass:: Timescale
:members:

.. attributeable:: Tremolo
.. attributetable:: Tremolo

.. autoclass:: Tremolo
:members:

.. attributeable:: Vibrato
.. attributetable:: Vibrato

.. autoclass:: Vibrato
:members:

.. attributeable:: Rotation
.. attributetable:: Rotation

.. autoclass:: Rotation
:members:

.. attributeable:: Distortion
.. attributetable:: Distortion

.. autoclass:: Distortion
:members:

.. attributeable:: ChannelMix
.. attributetable:: ChannelMix

.. autoclass:: ChannelMix
:members:

.. attributeable:: LowPass
.. attributetable:: LowPass

.. autoclass:: LowPass
:members:
Expand All @@ -214,9 +242,40 @@ Exceptions
----------

.. py:exception:: WavelinkException
Base wavelink exception.

.. py:exception:: AuthorizationFailed
Exception raised when password authorization failed for this Lavalink node.

.. py:exception:: InvalidNode
.. py:exception:: InvalidLavalinkVersion
Exception raised when you try to use wavelink 2 with a Lavalink version under 3.7.

.. py:exception:: InvalidLavalinkResponse
Exception raised when wavelink receives an invalid response from Lavalink.

status: :class:`int` | :class:`None`
The status code. Could be :class:`None`.

.. py:exception:: NoTracksError
Exception raised when no tracks could be found.

.. py:exception:: QueueEmpty
Exception raised when you try to retrieve from an empty queue.

.. py:exception:: InvalidChannelStateError
Base exception raised when an error occurs trying to connect to a :class:`discord.VoiceChannel`.

.. py:exception:: InvalidChannelPermissions
Exception raised when the client does not have correct permissions to join the channel.

Could also be raised when there are too many users already in a user limited channel.

0 comments on commit 46cb101

Please sign in to comment.