Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation additions and fixes #804

Merged
merged 3 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ match that of the versioning scheme. There are utilities under `hikari.internal.

To aid with the generation of `CHANGELOG.md` as well as the releases changelog we use `towncrier`.

You will need to install `towncrier` and `hikari` from source before making changelog additions.
```bash
pip install towncrier
pip install -e .
```

For every pull request made to this project, there should be a short explanation of the change under `changes/`
with the following format: `{pull_request_number}.{type}.md`,

Expand All @@ -44,7 +50,7 @@ description so that a maintainer can skip the job that checks for newly added fr
Best way to create the fragments is to run `towncrier create {pull_request_number}.{type}.md` after creating the
pull request, edit the created file and committing the changes.

Multiple fragments types can be created per pull request if it covers multiple areas.
Multiple fragment types can be created per pull request if it covers multiple areas.

# Branches

Expand All @@ -65,6 +71,11 @@ with a small description of the branch.

We have nox to help out with running pipelines locally and provides some helpful functionality.

You will need to install `nox` locally before running any pipelines.
```bash
pip install nox
```

Nox is similar to tox, but uses a pure Python configuration instead of an INI based configuration. Nox and tox are
both tools for generating virtual environments and running commands in those environments. Examples of usage include
installing, configuring, and running flake8, running pytest, etc.
Expand Down
1 change: 1 addition & 0 deletions changes/804.doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add docstrings to the remaining undocumented `GatewayBot` methods
Jonxslays marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions changes/804.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the `add_component` method to `hikari.api.special_endpoints.ActionRowBuilder`
25 changes: 19 additions & 6 deletions hikari/api/event_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,11 @@ async def on_everyone_mentioned(event):

See Also
--------
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Listen: `hikari.api.event_manager.EventManager.listen`
Stream: `hikari.api.event_manager.EventManager.stream`
Wait for: `hikari.api.event_manager.EventManager.wait_for`
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Unsubscribe: `hikari.api.event_manager.EventManager.unsubscribe`
Wait_for: `hikari.api.event_manager.EventManager.wait_for`
"""

# Yes, this is not generic. The reason for this is MyPy complains about
Expand Down Expand Up @@ -271,9 +273,11 @@ async def on_message(event):

See Also
--------
Dispatch: `hikari.api.event_manager.EventManager.dispatch`
Listen: `hikari.api.event_manager.EventManager.listen`
Stream: `hikari.api.event_manager.EventManager.stream`
Wait for: `hikari.api.event_manager.EventManager.wait_for`
Unsubscribe: `hikari.api.event_manager.EventManager.unsubscribe`
Wait_for: `hikari.api.event_manager.EventManager.wait_for`
"""

# Yes, this is not generic. The reason for this is MyPy complains about
Expand Down Expand Up @@ -306,6 +310,14 @@ async def on_message(event):

bot.unsubscribe(MessageCreateEvent, on_message)
```

See Also
--------
Dispatch: `hikari.api.event_manager.EventManager.dispatch`
Listen: `hikari.api.event_manager.EventManager.listen`
Stream: `hikari.api.event_manager.EventManager.stream`
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Wait_for: `hikari.api.event_manager.EventManager.wait_for`
"""

@abc.abstractmethod
Expand Down Expand Up @@ -373,7 +385,7 @@ def listen(
Stream: `hikari.api.event_manager.EventManager.stream`
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Unsubscribe: `hikari.api.event_manager.EventManager.unsubscribe`
Wait for: `hikari.api.event_manager.EventManager.wait_for`
Wait_for: `hikari.api.event_manager.EventManager.wait_for`
"""

@abc.abstractmethod
Expand Down Expand Up @@ -439,7 +451,7 @@ def stream(
Listen: `hikari.api.event_manager.EventManager.listen`
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Unsubscribe: `hikari.api.event_manager.EventManager.unsubscribe`
Wait for: `hikari.api.event_manager.EventManager.wait_for`
Wait_for: `hikari.api.event_manager.EventManager.wait_for`
"""

@abc.abstractmethod
Expand Down Expand Up @@ -486,8 +498,9 @@ async def wait_for(

See Also
--------
Dispatch: `hikari.api.event_manager.EventManager.dispatch`
Listen: `hikari.api.event_manager.EventManager.listen`
Stream: `hikari.api.event_manager.EventManager.stream`
Subscribe: `hikari.api.event_manager.EventManager.subscribe`
Dispatch: `hikari.api.event_manager.EventManager.dispatch`
Unsubscribe: `hikari.api.event_manager.EventManager.unsubscribe`
"""
24 changes: 24 additions & 0 deletions hikari/api/special_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -1491,6 +1491,30 @@ def components(self) -> typing.Sequence[ComponentBuilder]:
Sequence of the component builders registered within this action row.
"""

@abc.abstractmethod
def add_component(
self: _T,
component: ComponentBuilder,
/,
) -> _T:
"""Add a component to this action row builder.

!!! warning
It is generally better to use `ActionRowBuilder.add_button`
and `ActionRowBuilder.add_select_menu` to add your
component to the builder. Those methods utilize this one.

Parameters
----------
component : ComponentBuilder
The component builder to add to the action row.

Returns
-------
ActionRowBuilder
The builder object to enable chained calls.
"""

@typing.overload
@abc.abstractmethod
def add_button(
Expand Down
2 changes: 1 addition & 1 deletion hikari/guilds.py
Original file line number Diff line number Diff line change
Expand Up @@ -2931,7 +2931,7 @@ def get_voice_state(
def get_emoji(
self, emoji: snowflakes.SnowflakeishOr[emojis_.CustomEmoji]
) -> typing.Optional[emojis_.KnownCustomEmoji]:
"""Get a cached role that belongs to the guild by it's ID or object.
"""Get a cached emoji that belongs to the guild by it's ID or object.

Parameters
----------
Expand Down
Loading