diff --git a/docs/assets/expiration.png b/docs/assets/expiration.png new file mode 100644 index 00000000..df6141b3 Binary files /dev/null and b/docs/assets/expiration.png differ diff --git a/docs/interactions/reply.md b/docs/interactions/reply.md new file mode 100644 index 00000000..22e0886b --- /dev/null +++ b/docs/interactions/reply.md @@ -0,0 +1 @@ +# Reply Building \ No newline at end of file diff --git a/docs/start/runtime.md b/docs/start/runtime.md index 98d78801..bf7b8d14 100644 --- a/docs/start/runtime.md +++ b/docs/start/runtime.md @@ -72,10 +72,10 @@ is explicitly called. ``` ### Inactivity -You can also adjust the time frame until a `Runtime` gets closed. +You can also adjust the time frame for a `Runtime` to be closed. !!! example - ```java title="Main.java" hl_lines="2" + ```java title="Main.java" JDACommands.builder(jda, Main.class) .expirationStrategy(new ExpirationStrategy.Inactivity(20))//(1)! .start(); @@ -91,11 +91,29 @@ By default, Buttons, SelectMenus and Modals are `runtime-bound`. This means that `Runtime` as the interaction that replied with them. However, this also means that they cannot be executed anymore after the `Runtime` is closed. JDA-Commands will handle -that case and remove the component in question. It will also send an ephemeral reply to the user, saying that the +that case and remove the component. It will also send an ephemeral reply to the user, saying that the component is no longer available. +![Expiration Message](../assets/expiration.png) +/// caption +You can customize this error message, find more about it [here](TODO link). +/// ### Independent +You can also reply with components that are `runtime-independent`, making them virtually immortal. They will create a +new `Runtime` everytime they are executed. -!!! info - Modals cannot be independent because they always need a parent interaction that triggers them! \ No newline at end of file +These components will even work after a full bot restart! If you want them to not be usable anymore you need to remove +them on your own. + +!!! info inline end + Modals cannot be independent because they always need a parent interaction that triggers them! + +!!! example + ```java + @SlashCommand("greet") + public void onCommand(CommandEvent event) { + event.with().components(Component.independent("onButton")).reply("Hello World!"); + } + ``` +_Read more about building replies [here](../interactions/reply.md)._ \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 016efc09..5b3618da 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -47,6 +47,7 @@ plugins: - open-in-new-tab markdown_extensions: + - pymdownx.blocks.caption - admonition - pymdownx.details - pymdownx.highlight