Skip to content

Commit

Permalink
Update guides and docs, update signatures for new hikari features, re…
Browse files Browse the repository at this point in the history
…move description localisations from context menu commands
  • Loading branch information
tandemdude committed Mar 4, 2023
1 parent 55416fb commit 1f91bae
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/hikari_basics/components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on your bot's REST client.
.. code-block:: python
# Bot is assumed to be an instance of GatewayBot or a subclass
row = bot.rest.build_action_row()
row = bot.rest.build_message_action_row()
To add a button to the action row, the method ``add_button`` is used. Likewise, ``add_select_menu`` is used to add
a select menu to the row. The following examples will only be for buttons, however select menus are very similar
Expand Down
4 changes: 2 additions & 2 deletions examples/in_depth_component_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def generate_rows(bot: lightbulb.BotApp) -> t.Iterable[MessageActionRowBui
rows: t.List[MessageActionRowBuilder] = []

# Build the first action row
row = bot.rest.build_action_row()
row = bot.rest.build_message_action_row()

# Here we iterate len(COLORS) times.
for i in range(len(COLORS)):
Expand All @@ -73,7 +73,7 @@ async def generate_rows(bot: lightbulb.BotApp) -> t.Iterable[MessageActionRowBui
# append the first row to rows and build the second
# action row. (Gives a more even button layout)
rows.append(row)
row = bot.rest.build_action_row()
row = bot.rest.build_message_action_row()

# Extract the current color from the mapping and assign
# to this label var for later.
Expand Down
4 changes: 4 additions & 0 deletions lightbulb/commands/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
def options(self) -> t.Dict[str, t.Any]:
return {}

@property
def description_localizations(self) -> t.Mapping[t.Union[hikari.Locale, str], str]:
return {}

def _validate_attributes(self) -> None:
if len(self.name) < 1 or len(self.name) > 32:
raise ValueError(f"Message command {self.name!r}: name must be from 1-32 characters long") from None
Expand Down
4 changes: 4 additions & 0 deletions lightbulb/commands/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def __init__(self, *args: t.Any, **kwargs: t.Any) -> None:
def options(self) -> t.Dict[str, t.Any]:
return {}

@property
def description_localizations(self) -> t.Mapping[t.Union[hikari.Locale, str], str]:
return {}

def _validate_attributes(self) -> None:
if len(self.name) < 1 or len(self.name) > 32:
raise ValueError(f"User command {self.name!r}: name must be from 1-32 characters long") from None
Expand Down
2 changes: 2 additions & 0 deletions lightbulb/context/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ async def respond(
tts: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
nonce: hikari.UndefinedOr[str] = hikari.UNDEFINED,
reply: hikari.UndefinedOr[hikari.SnowflakeishOr[hikari.PartialMessage]] = hikari.UNDEFINED,
reply_must_exist: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
mentions_everyone: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
mentions_reply: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
user_mentions: hikari.UndefinedOr[
Expand Down Expand Up @@ -377,6 +378,7 @@ async def respond(
tts: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
nonce: hikari.UndefinedOr[str] = hikari.UNDEFINED,
reply: hikari.UndefinedOr[hikari.SnowflakeishOr[hikari.PartialMessage]] = hikari.UNDEFINED,
reply_must_exist: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
mentions_everyone: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
mentions_reply: hikari.UndefinedOr[bool] = hikari.UNDEFINED,
user_mentions: hikari.UndefinedOr[
Expand Down

0 comments on commit 1f91bae

Please sign in to comment.