From 67261514f37258759a8ab750b8019346f66c203a Mon Sep 17 00:00:00 2001 From: "thomm.o" Date: Sat, 4 Mar 2023 13:10:07 +0000 Subject: [PATCH] Update guides and docs, update signatures for new hikari features, remove description localisations from context menu commands --- docs/source/hikari_basics/components.rst | 2 +- examples/in_depth_component_example.py | 4 ++-- lightbulb/commands/message.py | 4 ++++ lightbulb/commands/user.py | 4 ++++ lightbulb/context/base.py | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/source/hikari_basics/components.rst b/docs/source/hikari_basics/components.rst index fad6d940..f6f522a7 100644 --- a/docs/source/hikari_basics/components.rst +++ b/docs/source/hikari_basics/components.rst @@ -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 diff --git a/examples/in_depth_component_example.py b/examples/in_depth_component_example.py index 68d98563..1c79e92c 100644 --- a/examples/in_depth_component_example.py +++ b/examples/in_depth_component_example.py @@ -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)): @@ -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. diff --git a/lightbulb/commands/message.py b/lightbulb/commands/message.py index 0a1e7507..bcf863e8 100644 --- a/lightbulb/commands/message.py +++ b/lightbulb/commands/message.py @@ -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 diff --git a/lightbulb/commands/user.py b/lightbulb/commands/user.py index bdefb524..f5ccabca 100644 --- a/lightbulb/commands/user.py +++ b/lightbulb/commands/user.py @@ -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 diff --git a/lightbulb/context/base.py b/lightbulb/context/base.py index a55fa627..6b7388f6 100644 --- a/lightbulb/context/base.py +++ b/lightbulb/context/base.py @@ -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[ @@ -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[