Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
199 commits
Select commit Hold shift + click to select a range
74aa538
first prototype
elenakrittik Aug 29, 2022
a27fa3e
I love to resolve merge conflicts (no.)
elenakrittik Aug 29, 2022
e27dfda
Fix 'undefined label' errors (probably..)
elenakrittik Aug 29, 2022
bcd4f59
Fix another error
elenakrittik Aug 30, 2022
bc50961
random commit message
elenakrittik Aug 30, 2022
cf38fd7
'undefined label' finale, i guess?
elenakrittik Aug 30, 2022
9d6cc04
apply fixes
elenakrittik Aug 30, 2022
280daa7
Align classes' markers with their grouping in current api.rst
elenakrittik Sep 1, 2022
26bd9e4
Merge latest changes
elenakrittik Sep 1, 2022
ffbc600
Apply fix (if any lol)
elenakrittik Sep 1, 2022
52361f2
Split up ext.commands docs
elenakrittik Sep 2, 2022
7bf4e17
Merge branch 'master' into split-up-docs
elenakrittik Sep 2, 2022
fe788e5
Add small changelog
elenakrittik Sep 2, 2022
84734b0
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 3, 2022
1e7d028
Renamed links
elenakrittik Sep 3, 2022
703fb8e
Finale??
elenakrittik Sep 3, 2022
ddeafa4
Add missing Range, String etc.
elenakrittik Sep 4, 2022
3550ff5
fix sidebar labels
elenakrittik Sep 4, 2022
424e3d8
apply fix
elenakrittik Sep 4, 2022
3be8e90
pypypyyypy
elenakrittik Sep 4, 2022
01c3540
chore: add SphinxExtensionMeta to fulltoc
onerandomusername Sep 4, 2022
7a59c62
fix: indent the created toc
onerandomusername Sep 4, 2022
33c4d19
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 5, 2022
afdccf1
Merge branch 'split-up-docs' of https://github.com/ItsAleph/disnake i…
elenakrittik Sep 5, 2022
d2f08fb
You want it, you got it.
elenakrittik Sep 5, 2022
0189d3f
Add related events links at the bottom of pages
elenakrittik Sep 6, 2022
a9c5fcf
.-.
elenakrittik Sep 6, 2022
5a63685
Merge latest changes
elenakrittik Sep 6, 2022
da76c15
fix
elenakrittik Sep 6, 2022
f4ad1b9
fix fix fix ...
elenakrittik Sep 6, 2022
428f69c
:confetti: Redirects draft!
elenakrittik Sep 6, 2022
abcf74c
:shiny: Redirects!
elenakrittik Sep 6, 2022
4cc42e0
Changelog, no-script and no invalid urls
elenakrittik Sep 6, 2022
d804ac6
fuck javascript
elenakrittik Sep 7, 2022
f2a2a67
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 7, 2022
03cade4
Merge branch 'split-up-docs' of https://github.com/ItsAleph/disnake i…
elenakrittik Sep 7, 2022
123686a
smol nit
elenakrittik Sep 7, 2022
41e9e59
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 8, 2022
b142a4e
Auto-scroll & auto-collapse
elenakrittik Sep 9, 2022
e1ff6ed
thanks read the docs
elenakrittik Sep 9, 2022
61fa255
thanks shared namespace
elenakrittik Sep 9, 2022
25e39ae
chore: define redirects as safe for parallel reads
onerandomusername Sep 9, 2022
3383c5b
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 9, 2022
80b4693
Lts
elenakrittik Sep 9, 2022
667e1f8
test1
elenakrittik Sep 9, 2022
19f8aa2
test1
elenakrittik Sep 9, 2022
67cae53
testestestestest
elenakrittik Sep 10, 2022
6fa8d23
Holy rubbery duck
elenakrittik Sep 10, 2022
b535770
gg
elenakrittik Sep 10, 2022
95d8608
gg
elenakrittik Sep 10, 2022
4394eb5
gg
elenakrittik Sep 10, 2022
2aacbeb
gg
elenakrittik Sep 10, 2022
c484892
test
elenakrittik Sep 10, 2022
f781385
test
elenakrittik Sep 10, 2022
46d8d92
test
elenakrittik Sep 10, 2022
f6861fb
ItsNotMyFault:tm:
elenakrittik Sep 10, 2022
1922835
i told you
elenakrittik Sep 10, 2022
b6a1de0
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Sep 10, 2022
1109633
D
elenakrittik Sep 10, 2022
f6cce1c
chore: use proper typehint for docs ext setup()
onerandomusername Sep 11, 2022
8819ed2
Merge latest changes
elenakrittik Sep 14, 2022
51bfdb7
revert ignoring readthedocs banner
onerandomusername Sep 15, 2022
76ae555
Merge latest changes
elenakrittik Sep 18, 2022
102dea1
lmfao what
elenakrittik Sep 19, 2022
791ba2b
:mmwhereismynose:
elenakrittik Sep 19, 2022
50b9626
Merge branch 'master' into split-up-docs
onerandomusername Sep 21, 2022
a09a6bf
chore(docs): fix plurals in doc section titles
Sharp-Eyes Sep 21, 2022
23a48d4
Only load redirects on api.html and ext/commands/api.html
elenakrittik Sep 22, 2022
4850d57
Merge latest changes
elenakrittik Sep 23, 2022
06f0d53
Fix lint
elenakrittik Sep 23, 2022
cf8f2e1
Update docs/api/automod.rst
elenakrittik Sep 24, 2022
7da7407
Update docs/extensions/fulltoc.py
elenakrittik Sep 24, 2022
d15ddd7
if you read this you are cool
elenakrittik Sep 24, 2022
48fc5a9
try
elenakrittik Sep 24, 2022
52050fb
mhmh
elenakrittik Sep 24, 2022
e7ca779
Update disnake/message.py
elenakrittik Sep 24, 2022
748eed7
Update docs/_static/api_redirect.js
elenakrittik Sep 24, 2022
a3480cb
Update docs/_static/api_redirect.js
elenakrittik Sep 24, 2022
e4eb739
Update docs/extensions/fulltoc.py
elenakrittik Sep 24, 2022
148a144
Update docs/extensions/fulltoc.py
elenakrittik Sep 24, 2022
9684a5a
Update docs/_static/scroll_sidebar.js
elenakrittik Sep 24, 2022
c78d88a
Update docs/discord.rst
elenakrittik Sep 24, 2022
aaf975b
Update docs/extensions/redirects.py
elenakrittik Sep 24, 2022
4cf7450
p
elenakrittik Sep 24, 2022
d8070db
w
elenakrittik Sep 24, 2022
cc8c113
d
elenakrittik Sep 24, 2022
59fc9e0
r
elenakrittik Sep 24, 2022
8375080
u
elenakrittik Sep 25, 2022
755b12c
y
elenakrittik Sep 25, 2022
97c2d13
Update docs/_templates/layout.html
elenakrittik Sep 25, 2022
c31be52
Update docs/api.rst
elenakrittik Sep 25, 2022
8ae8ae8
Update docs/ext/commands/api.rst
elenakrittik Sep 25, 2022
0327c91
Update docs/ext/commands/api.rst
elenakrittik Sep 25, 2022
3c66250
Update docs/api.rst
elenakrittik Sep 25, 2022
5b04604
Update changelog/392.doc.rst
elenakrittik Sep 26, 2022
c209608
500m
elenakrittik Oct 4, 2022
4ea6d47
1000m
elenakrittik Oct 4, 2022
8961517
1500m
elenakrittik Oct 4, 2022
d4e99da
1501m
elenakrittik Oct 4, 2022
98b380e
1502m
elenakrittik Oct 4, 2022
2659a72
1503m
elenakrittik Oct 4, 2022
97718e8
fix: reformat and resolve all related event links
onerandomusername Oct 5, 2022
3d5663c
fix: correct broken references missed in last commit
onerandomusername Oct 5, 2022
79ba841
Update docs/extensions/redirects.py
elenakrittik Oct 6, 2022
dc34db6
chore: remove unused import
onerandomusername Oct 6, 2022
accf507
Merge branch 'master' of https://github.com/DisnakeDev/disnake into s…
elenakrittik Oct 6, 2022
15e3347
The summit?
elenakrittik Oct 6, 2022
6b5a509
The summit!
elenakrittik Oct 6, 2022
37e164b
add short desc to abc.rst
elenakrittik Oct 6, 2022
72282e3
fix danny's skill issue
elenakrittik Oct 7, 2022
5ac7772
change related events in ext cmds
elenakrittik Oct 7, 2022
56114f0
Merge latest changes
elenakrittik Oct 7, 2022
6c7f622
imagine being dumb
elenakrittik Oct 7, 2022
d595ae5
Resolves merge conflicts
elenakrittik Oct 18, 2022
779e66d
Merge latest changes
elenakrittik Oct 18, 2022
c4027ca
chore: merge the glossary back into the main api/index.rst
onerandomusername Oct 18, 2022
629d587
Merge branch 'split-up-docs' of https://github.com/ItsAleph/disnake i…
elenakrittik Oct 18, 2022
129cfe3
Stuff
elenakrittik Oct 18, 2022
fc855ee
fix
elenakrittik Oct 19, 2022
f473872
Merge branch 'master' into split-up-docs
onerandomusername Oct 19, 2022
3ce5092
fix
elenakrittik Oct 19, 2022
c75d8ac
chore: data classes -> Data Classes
onerandomusername Oct 19, 2022
e0a708a
feat: sort discord models and dataclasses in the documentation
onerandomusername Oct 19, 2022
c294845
chore: update subfile names
onerandomusername Oct 19, 2022
ad880de
chore: reorder extensions
onerandomusername Oct 19, 2022
3196dc5
nit: shorten bar under voice
onerandomusername Oct 20, 2022
2273ef0
Merge branch 'master' into split-up-docs
onerandomusername Oct 20, 2022
b2142dd
fix: add back missing :inherited-members: for Activity classes
onerandomusername Oct 20, 2022
63f0e7e
fix: apply missed doc changes from #698
onerandomusername Oct 20, 2022
a403e90
chore: undoc original_message
onerandomusername Oct 20, 2022
bb3e931
nit: trim prefix
onerandomusername Oct 20, 2022
a6a7749
fix search
onerandomusername Oct 24, 2022
b704b99
update ext/commands toc
onerandomusername Oct 24, 2022
38d1094
chore: seperate api redirect into a template
onerandomusername Oct 24, 2022
2923cd2
chore: remove scroll_sidebar.js
onerandomusername Oct 24, 2022
b18f2b8
chore: delet the duplicated text
onerandomusername Oct 25, 2022
701eee6
Merge branch 'master' into split-up-docs
onerandomusername Oct 26, 2022
8f41342
fix up legacy api.rst pages
onerandomusername Oct 26, 2022
8d00c66
remove regular command references
onerandomusername Oct 26, 2022
fae74e3
captials
onerandomusername Oct 26, 2022
210b9e8
chore: update link to use a role
onerandomusername Oct 26, 2022
548909d
rewrite enums tldr
onerandomusername Oct 26, 2022
eda3e85
reverse discord models and dataclass defintions
onerandomusername Oct 26, 2022
ed6b01f
simplify integration description
onerandomusername Oct 26, 2022
bfc1e1d
remove the extra newlines not deleted as part of b18f2b84748354d9881e…
onerandomusername Oct 26, 2022
a58a9ac
Merge branch 'master' into split-up-docs
onerandomusername Oct 26, 2022
6ff6143
Apply suggestions from code review
onerandomusername Oct 27, 2022
da4fbbd
fix: recategorise objects to their correct category
onerandomusername Oct 28, 2022
dc3d232
Merge branch 'master' into split-up-docs
onerandomusername Oct 30, 2022
729fcb9
fix: move spotify to discord models
onerandomusername Oct 30, 2022
6a7b792
Partial revert "remove the extra newlines not deleted as part of b18f…
onerandomusername Oct 30, 2022
acc9563
Merge branch 'master' into split-up-docs
onerandomusername Feb 19, 2023
d11e3d2
Merge branch 'master' into split-up-docs
onerandomusername Feb 24, 2023
8e5cd69
no new lines in roles description
onerandomusername Feb 24, 2023
38634f4
Apply suggestions from code review
onerandomusername Feb 24, 2023
8af7ec0
Merge branch 'master' into split-up-docs
onerandomusername Feb 26, 2023
b945d5d
Merge branch 'master' into split-up-docs
onerandomusername Feb 26, 2023
97c1aa0
Merge branch 'master' into split-up-docs
onerandomusername Feb 27, 2023
5750ffc
Merge branch 'master' into split-up-docs
onerandomusername Mar 1, 2023
aec4a13
Merge branch 'master' into split-up-docs
onerandomusername Mar 1, 2023
708c72c
fix: update page descriptions
shiftinv Mar 17, 2023
d7d5f3a
chore: slightly simplify sidebar code
shiftinv Mar 17, 2023
14f4435
fix: switch around some data classes/discord models
shiftinv Mar 17, 2023
c526378
chore: remove "related events" links
shiftinv Mar 17, 2023
92bafea
docs: mention `wait_for` on events page
shiftinv Mar 17, 2023
07d0e97
fix: remove nonstandard "Raw Events" section
shiftinv Mar 17, 2023
1e5ef46
chore: move `on_x_error` events below non-error events
shiftinv Mar 17, 2023
1c528ed
refactor: move cogs to their own reference page
shiftinv Mar 17, 2023
0a08602
refactor: make redirect handler more generic
shiftinv Mar 18, 2023
dd8ef93
feat: redirect immediately instead of waiting for dom load
shiftinv Mar 18, 2023
acdc92b
fix: assert source asset path exists in redirects extension
shiftinv Mar 18, 2023
4f4d0ff
refactor(docs): move redirect mapping in extension to separate function
shiftinv Mar 18, 2023
69e2c39
chore(docs): more consistent page label/anchor names
shiftinv Mar 18, 2023
5a2ae4c
fix(docs): fix event docs link in `Client.event`
shiftinv Mar 18, 2023
9f481b7
docs: improve docstrings/comments in fulltoc ext
shiftinv Apr 3, 2023
0805da7
chore: s/pagename/docname/
shiftinv Apr 3, 2023
ce5e194
chore: move `includehidden` parameter
shiftinv Apr 3, 2023
ae45e97
chore: remove presumably unnecessary call to `env.resolve_references`
shiftinv Apr 3, 2023
627c038
chore(docs): update event order
shiftinv Apr 3, 2023
8e3190b
fix(docs): add missing event links on api pages
shiftinv Apr 3, 2023
48c99b7
chore(docs): move `VoiceState` from members to voice
shiftinv Apr 3, 2023
cd0af27
fix(docs): move ui decorators to end of page
shiftinv Apr 3, 2023
ad2ed27
fix(docs): add missing `:decorator:` directives to autofunctions
shiftinv Apr 3, 2023
fdf9919
chore(docs/ui): keep old select order
shiftinv Apr 3, 2023
8f4b69f
Merge remote-tracking branch 'upstream/master'
shiftinv Apr 4, 2023
a5dfdab
fix(docs): fix sidebar scroll being offset
shiftinv Apr 5, 2023
15c9a0c
refactor: move sidebar scrolling into `Sidebar` class
shiftinv Apr 5, 2023
449900f
fix(docs): resync contents with master branch
shiftinv Apr 6, 2023
60c4593
docs: swap some Discord Model/Data Class categorizations
shiftinv Apr 6, 2023
e98ac21
fix(docs): move classes into correct files
shiftinv Apr 6, 2023
e056b39
fix(docs): add missing enum headers
shiftinv Apr 6, 2023
4af42ff
chore: add missing parentheses
shiftinv Apr 6, 2023
a1ff22f
Merge remote-tracking branch 'upstream/master'
shiftinv Apr 6, 2023
d536e73
fix: set robots noindex on api redirect pages
shiftinv Apr 6, 2023
d242072
update the changelog
onerandomusername Apr 8, 2023
4545571
docs(changelog): link to index pages
shiftinv Apr 8, 2023
ed784d6
changelog: retitle the api references
onerandomusername Apr 8, 2023
a64ba22
Merge branch 'master' into split-up-docs
onerandomusername Apr 8, 2023
d2f3135
readd a period
onerandomusername Apr 8, 2023
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
5 changes: 5 additions & 0 deletions changelog/392.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Split the monolithic API Reference pages into multiple sub-references.
- Main ``disnake`` API reference can now be found at :doc:`API Reference <api/index>`.
- ``disnake.ext.commands`` API reference is now under :doc:`Commands API Reference <ext/commands/api/index>`.
- Legacy ``api.html`` and ``ext/commands/api.html`` pages are deprecated.
- - Links with pre-existing references (eg ``/api.html#disnake.AppInfo``) will be redirected to their appropriate page.
2 changes: 1 addition & 1 deletion disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
class Snowflake(Protocol):
"""An ABC that details the common operations on a Discord model.

Almost all :ref:`Discord models <discord_api_models>` meet this
Almost all :ref:`Discord models <discord_model>` meet this
abstract base class.

If you want to create a snowflake on your own, consider using
Expand Down
1 change: 1 addition & 0 deletions disnake/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def to_dict(self) -> ActivityPayload:
# tag type for user-settable activities
class BaseActivity(_BaseActivity):
"""The base activity that all user-settable activities inherit from.

A user-settable activity is one that can be used in :meth:`Client.change_presence`.

The following types currently count as user-settable:
Expand Down
8 changes: 4 additions & 4 deletions disnake/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ def wait_for(

In case the event returns multiple arguments, a :class:`tuple` containing those
arguments is returned instead. Please check the
:ref:`documentation <discord-api-events>` for a list of events and their
:ref:`documentation <disnake_api_events>` for a list of events and their
parameters.

This function returns the **first event that meets the requirements**.
Expand Down Expand Up @@ -1594,7 +1594,7 @@ def check(reaction, user):
Parameters
----------
event: Union[:class:`str`, :class:`.Event`]
The event name, similar to the :ref:`event reference <discord-api-events>`,
The event name, similar to the :ref:`event reference <disnake_api_events>`,
but without the ``on_`` prefix, to wait for. It's recommended
to use :class:`.Event`.
check: Optional[Callable[..., :class:`bool`]]
Expand All @@ -1614,7 +1614,7 @@ def check(reaction, user):
Any
Returns no arguments, a single argument, or a :class:`tuple` of multiple
arguments that mirrors the parameters passed in the
:ref:`event reference <discord-api-events>`.
:ref:`event <disnake_api_events>`.
"""
future = self.loop.create_future()
if check is None:
Expand All @@ -1639,7 +1639,7 @@ def _check(*args) -> bool:
def event(self, coro: CoroT) -> CoroT:
"""A decorator that registers an event to listen to.

You can find more info about the events on the :ref:`documentation below <discord-api-events>`.
You can find more info about the events in the :ref:`documentation <disnake_api_events>`.

The events must be a :ref:`coroutine <coroutine>`, if not, :exc:`TypeError` is raised.

Expand Down
40 changes: 20 additions & 20 deletions disnake/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,14 +1001,14 @@ class Event(Enum):
"""Called when a `Guild` creates a new `Role`.
Represents the :func:`on_guild_role_create` event.
"""
guild_role_update = "guild_role_update"
"""Called when a `Guild` updates a `Role`.
Represents the :func:`on_guild_role_update` event.
"""
guild_role_delete = "guild_role_delete"
"""Called when a `Guild` deletes a `Role`.
Represents the :func:`on_guild_role_delete` event.
"""
guild_role_update = "guild_role_update"
"""Called when a `Guild` updates a `Role`.
Represents the :func:`on_guild_role_update` event.
"""
guild_emojis_update = "guild_emojis_update"
"""Called when a `Guild` adds or removes `Emoji`.
Represents the :func:`on_guild_emojis_update` event.
Expand Down Expand Up @@ -1069,6 +1069,10 @@ class Event(Enum):
"""Called when an `AutoModRule` is deleted.
Represents the :func:`on_automod_rule_delete` event.
"""
audit_log_entry_create = "audit_log_entry_create"
"""Called when an audit log entry is created.
Represents the :func:`on_audit_log_entry_create` event.
"""
integration_create = "integration_create"
"""Called when an integration is created.
Represents the :func:`on_integration_create` event.
Expand All @@ -1085,14 +1089,14 @@ class Event(Enum):
"""Called when a `Member` joins a `Guild`.
Represents the :func:`on_member_join` event.
"""
member_update = "member_update"
"""Called when a `Member` updates their profile.
Represents the :func:`on_member_update` event.
"""
member_remove = "member_remove"
"""Called when a `Member` leaves a `Guild`.
Represents the :func:`on_member_remove` event.
"""
member_update = "member_update"
"""Called when a `Member` updates their profile.
Represents the :func:`on_member_update` event.
"""
raw_member_remove = "raw_member_remove"
"""Called when a member leaves a `Guild` regardless of the member cache.
Represents the :func:`on_raw_member_remove` event.
Expand All @@ -1101,10 +1105,6 @@ class Event(Enum):
"""Called when a member updates their profile regardless of the member cache.
Represents the :func:`on_raw_member_update` event.
"""
audit_log_entry_create = "audit_log_entry_create"
"""Called when an audit log entry is created.
Represents the :func:`on_audit_log_entry_create` event.
"""
member_ban = "member_ban"
"""Called when user gets banned from a `Guild`.
Represents the :func:`on_member_ban` event.
Expand All @@ -1129,14 +1129,14 @@ class Event(Enum):
"""Called when a `StageInstance` is created for a `StageChannel`.
Represents the :func:`on_stage_instance_create` event.
"""
stage_instance_update = "stage_instance_update"
"""Called when a `StageInstance` is updated.
Represents the :func:`on_stage_instance_update` event.
"""
stage_instance_delete = "stage_instance_delete"
"""Called when a `StageInstance` is deleted for a `StageChannel`.
Represents the :func:`on_stage_instance_delete` event.
"""
stage_instance_update = "stage_instance_update"
"""Called when a `StageInstance` is updated.
Represents the :func:`on_stage_instance_update` event.
"""
application_command = "application_command"
"""Called when an application command is invoked.
Represents the :func:`on_application_command` event.
Expand Down Expand Up @@ -1181,14 +1181,14 @@ class Event(Enum):
"""Called when messages are bulk deleted.
Represents the :func:`on_bulk_message_delete` event.
"""
raw_message_delete = "raw_message_delete"
"""Called when a message is deleted regardless of the message being in the internal message cache or not.
Represents the :func:`on_raw_message_delete` event.
"""
raw_message_edit = "raw_message_edit"
"""Called when a message is edited regardless of the state of the internal message cache.
Represents the :func:`on_raw_message_edit` event.
"""
raw_message_delete = "raw_message_delete"
"""Called when a message is deleted regardless of the message being in the internal message cache or not.
Represents the :func:`on_raw_message_delete` event.
"""
raw_bulk_message_delete = "raw_bulk_message_delete"
"""Called when a bulk delete is triggered regardless of the messages being in the internal message cache or not.
Represents the :func:`on_raw_bulk_message_delete` event.
Expand Down
2 changes: 1 addition & 1 deletion disnake/ext/commands/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class Bot(BotBase, InteractionBotBase, disnake.Client):
help_command: Optional[:class:`.HelpCommand`]
The help command implementation to use. This can be dynamically
set at runtime. To remove the help command pass ``None``. For more
information on implementing a help command, see :ref:`ext_commands_help_command`.
information on implementing a help command, see :ref:`ext_commands_api_help_commands`.

This can be provided as a parameter at creation.

Expand Down
2 changes: 1 addition & 1 deletion disnake/ext/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ async def invoke(self, ctx: Context) -> None:
await self.prepare(ctx)

# terminate the invoked_subcommand chain.
# since we're in a regular command (and not a group) then
# since we're in a regular prefix command (and not a group) then
# the invoked subcommand is None.
ctx.invoked_subcommand = None
ctx.subcommand_passed = None
Expand Down
6 changes: 3 additions & 3 deletions disnake/ext/commands/interaction_bot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def slash_command(
extras: Optional[Dict[str, Any]] = None,
**kwargs,
) -> Callable[[CommandCallback], InvokableSlashCommand]:
"""A shortcut decorator that invokes :func:`.slash_command` and adds it to
"""A shortcut decorator that invokes :func:`~disnake.ext.commands.slash_command` and adds it to
the internal command list.

Parameters
Expand Down Expand Up @@ -589,7 +589,7 @@ def user_command(
) -> Callable[
[InteractionCommandCallback[CogT, UserCommandInteraction, P]], InvokableUserCommand
]:
"""A shortcut decorator that invokes :func:`.user_command` and adds it to
"""A shortcut decorator that invokes :func:`~disnake.ext.commands.user_command` and adds it to
the internal command list.

Parameters
Expand Down Expand Up @@ -666,7 +666,7 @@ def message_command(
) -> Callable[
[InteractionCommandCallback[CogT, MessageCommandInteraction, P]], InvokableMessageCommand
]:
"""A shortcut decorator that invokes :func:`.message_command` and adds it to
"""A shortcut decorator that invokes :func:`~disnake.ext.commands.message_command` and adds it to
the internal command list.

Parameters
Expand Down
38 changes: 30 additions & 8 deletions docs/_static/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class Sidebar {
let next = ref.nextElementSibling;

if (next && next.tagName === "UL") {

let icon = document.createElement('span');
icon.className = 'material-icons collapsible-arrow expanded';
icon.innerText = 'expand_more';
Expand All @@ -54,24 +53,36 @@ class Sidebar {

ref.classList.add('ref-internal-padding')
ref.parentNode.insertBefore(icon, ref);

// collapse all top-level toc entries, except the current page's
// (i.e. all entries that don't contain a `#`)
const refUrl = new URL(ref.href);
if (!refUrl.hash) {
// `false` to update immediately
this.collapseSection(icon, false);
}
}
}
}

collapseSection(icon) {
collapseSection(icon, defer = true) {
icon.classList.remove('expanded');
icon.classList.add('collapsed');
let children = icon.nextElementSibling.nextElementSibling;
// <arrow><heading>
// --> <square><children>
setTimeout(() => children.style.display = "none", 75)
const update = () => children.style.display = "none";
if (defer) setTimeout(update, 75);
else update();
}

expandSection(icon) {
expandSection(icon, defer = true) {
icon.classList.remove('collapse');
icon.classList.add('expanded');
let children = icon.nextElementSibling.nextElementSibling;
setTimeout(() => children.style.display = "block", 75)
const update = () => children.style.display = "block";
if (defer) setTimeout(update, 75);
else update();
}

setActiveLink(section) {
Expand All @@ -92,6 +103,13 @@ class Sidebar {
}
}

scrollToCurrent() {
const currentSection = this.element.querySelector("li.current");
if (currentSection) {
// setTimeout(..., 0) to avoid layout race condition
setTimeout(() => currentSection.scrollIntoView({block: "center"}), 0);
}
}
}

function getCurrentSection() {
Expand All @@ -101,10 +119,12 @@ function getCurrentSection() {
}
else {
if (sections) {
const headerOffset = document.querySelector("main").offsetTop; // height of header
sections.forEach(section => {
let rect = section.getBoundingClientRect();
// offset to give space for the sticky header
if (rect.top - 90 + document.body.offsetTop < 1) {
const rect = section.getBoundingClientRect();
// plus offset for more leniency
// (section doesn't have to be scrolled all the way to the top to be considered active)
if (rect.top < headerOffset + 50) {
currentSection = section;
}
});
Expand All @@ -113,9 +133,11 @@ function getCurrentSection() {
return currentSection;
}

// create interactive sidebar
document.addEventListener('DOMContentLoaded', () => {
sidebar = new Sidebar(document.getElementById('sidebar'));
sidebar.createCollapsableSections();
sidebar.scrollToCurrent();

window.addEventListener('scroll', () => {
sidebar.setActiveLink(getCurrentSection());
Expand Down
41 changes: 41 additions & 0 deletions docs/_templates/api_redirect.js_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: MIT

"use strict";

const redirects_map = {{ redirect_data }};

(() => {
let url = new URL(document.location.href);

if (!url.pathname.endsWith("/api.html")) return;

// URL_ROOT is relative to `url`, and points to e.g. `<host>/en/latest/`
const root = new URL(DOCUMENTATION_OPTIONS.URL_ROOT, url);
if (!root.pathname.endsWith("/")) root.pathname += "/";

const targetPath = redirects_map[url.hash.slice(1)];

let newUrl = null;
if (targetPath) {
// Get current path relative to documentation root
// `/en/latest/xyz/api.html` => `xyz/api/`
let expectedPrefix = url.pathname.slice(root.pathname.length).replace(/\.html$/, "/");

// The target path (`xyz/api/events.html`) should start with `xyz/api/`
if (targetPath.startsWith(expectedPrefix)) {
newUrl = new URL(targetPath, root);
newUrl.hash = url.hash;
}
}

// If it's still unset, the #hash is unknown or the target doesn't match the current section;
// in that case, just redirect to the relevant index page.
if (newUrl === null) {
newUrl = new URL(url);
newUrl.pathname = newUrl.pathname.replace(/\/api.html$/, "/api/index.html");
newUrl.hash = "";
}

console.log(`Redirecting to ${newUrl.href}`);
window.location.replace(newUrl);
})();
15 changes: 9 additions & 6 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title|striptags|e }}{{ titlesuffix }}</title>
{%- block extrahead %} {% endblock %}
<!-- end extra head -->
<link rel="stylesheet" href="{{ pathto('_static/icons.css', 1)|e }}" type="text/css" />
{%- block css %}
{%- for css in css_files %}
Expand All @@ -22,6 +21,10 @@
<link rel="stylesheet" href="{{ pathto('_static/codeblocks.css', 1) }}" type="text/css" />
{%- block scripts %}
<script id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
{% if ("/" + pagename).endswith("/api") %}
<meta name="robots" content="noindex" />
<script type="text/javascript" src="{{ pathto('_static/api_redirect.js', 1) }}"></script>
{% endif %}
{%- for js in script_files %}
{{ js_tag(js) }}
{%- endfor %}
Expand Down Expand Up @@ -66,7 +69,7 @@
<header class="top-header mobile">
<nav>
<div class="header-breakpoint">
<a href="{{ pathto('api')|e }}" class="extension-nav">API Reference</a>
<a href="{{ pathto('api/index')|e }}" class="extension-nav">API Reference</a>
{%- for ext, p in discord_extensions %}
{% set ext_name = ext.split('.') %}
<a href="{{ pathto(p + '/index')|e }}" class="extension-nav {% if pagename.startswith(p) %}current-page{% endif %}">{{ ext_name[-1] }}</a>
Expand All @@ -76,11 +79,11 @@
</header>
<header class="sticky-header">
<nav>
<a href="{{ pathto(master_doc)|e }}" class="main-heading desktop">
<a href="{{ pathto(root_doc)|e }}" class="main-heading desktop">
<img class="disnake-main-logo" src="{{ pathto('_static/disnake.svg', 1)|e }}" alt="disnake">
</a>
<div class="header-breakpoint desktop extension-breakpoint desktop">
<a href="{{ pathto('api')|e }}" class="extension-nav">{{ _('API Reference') }}</a>
<a href="{{ pathto('api/index')|e }}" class="extension-nav">{{ _('API Reference') }}</a>
{%- for ext, p in discord_extensions %}
{% set ext_name = ext.split('.') %}
<a href="{{ pathto(p + '/index')|e }}" class="extension-nav {% if pagename.startswith(p) %}current-page{% endif %}">{{ ext_name[-1] }}</a>
Expand Down Expand Up @@ -111,11 +114,11 @@
</header>
{#- The sidebar component #}
<aside>
<a href="{{ pathto(master_doc)|e }}" class="mobile-heading">
<a href="{{ pathto(root_doc)|e }}" class="mobile-heading">
<img class="disnake-mobile-logo" src="{{ pathto('_static/disnake.svg', 1)|e }}" alt="disnake">
</a>
<div class="sidebar-extension-list mobile-heading">
<a href="{{ pathto('api')|e }}" class="extension-nav">API Reference</a>
<a href="{{ pathto('api/index')|e }}" class="extension-nav">API Reference</a>
{%- for ext, p in discord_extensions %}
{% set ext_name = ext.split('.') %}
<a href="{{ pathto(p + '/index')|e }}" class="extension-nav {% if pagename.startswith(p) %}current-page{% endif %}">{{ ext_name[-1] }}</a>
Expand Down
Loading