Open fgardt opened 2 months ago
I would recommend adding an unstable
feature flag to poise, which enables the unstable_discord_api
flag in serenity.
Also probably the docs should be updated with the new install_context
and interaction_context
options, if the unstable
feature is enabled?
I can also confirm, that this pr works as expected, when using the current branch of serenity (as is expected).
Hey, @fgardt do you plan on fixing the CI failures?
I'll look into it yeah
hello, i've been testing this pr more in depth and subcommands work weirdly:
lets say you have a parent command: /bot and you want to make a "reload" command for the bot owner which reloads the bot
#[poise::command(
slash_command,
subcommands("reload"),
install_context = "Guild|User",
// hmm... only 1 command needs to be different; so lets do a non-restrictive selection
interaction_context = "Guild|BotDm|PrivateChannel"
)]
pub async fn bot(_: Ctx<'_>) -> Result<(), CommandError> {}
#[poise::command(
slash_command,
owners_only,
// great! now we can make this a botdm command to prevent confusion?
install_context = "User",
interaction_context = "BotDm"
)]
pub async fn reload(ctx: Ctx<'_>) -> Result<(), CommandError> {
// ... reload logic
}
sadly, the subcommand has no control over its interaction_context or its install_context, which means the command will show up in guilds and in group dms, which is not the intended behavior
Subcommands inherit context and permissions from the parent, this is a limitation of discord itself. At most extra documentation (if there isn't any of inheriting context) can be added, but its already mentioned for permissions in our docs.
Any idea when this will be merged/released? I'd like to see this functionality become available.
Any idea when this will be merged/released? I'd like to see this functionality become available.
You are welcome to use this as your base for the mean time but it would be nice to see the API in serenity be updated first before this rolls out. It'll happen when it does and there is no ETA for this feature.
Any update on this?
Considering this isn't merged or hasn't had a single commit since your question answers itself, no, there is no update on this.
this is the implementation for user apps that I've been using like this since 3 days after user apps got announced / released to beta.
I like the flexibility that having
install_context
andinteraction_context
being separate properties brings but there were concerns regarding usability / it being too complex.example:
_note: this added the
unstable_discord_api
feature to the serenity dependency, that should probably be removed again(?) I have not found a nice way to feature guard this without having to chain the feature flag in everywhere and some other issues._